53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Reduce wp-admin latency in local Docker environments without outbound internet.
|
|
*/
|
|
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
if (function_exists('wp_get_environment_type') && wp_get_environment_type() !== 'local') {
|
|
return;
|
|
}
|
|
|
|
add_action('init', function () {
|
|
remove_action('admin_init', '_maybe_update_core');
|
|
remove_action('admin_init', '_maybe_update_plugins');
|
|
remove_action('admin_init', '_maybe_update_themes');
|
|
|
|
wp_clear_scheduled_hook('wp_version_check');
|
|
wp_clear_scheduled_hook('wp_update_plugins');
|
|
wp_clear_scheduled_hook('wp_update_themes');
|
|
}, 1);
|
|
|
|
add_filter('pre_site_transient_update_core', function () {
|
|
return (object) [
|
|
'updates' => [],
|
|
'last_checked' => time(),
|
|
'version_checked' => get_bloginfo('version'),
|
|
];
|
|
});
|
|
|
|
add_filter('pre_site_transient_update_plugins', function () {
|
|
return (object) [
|
|
'last_checked' => time(),
|
|
'checked' => [],
|
|
'response' => [],
|
|
'no_update' => [],
|
|
'translations' => [],
|
|
];
|
|
});
|
|
|
|
add_filter('pre_site_transient_update_themes', function () {
|
|
return (object) [
|
|
'last_checked' => time(),
|
|
'checked' => [],
|
|
'response' => [],
|
|
'no_update' => [],
|
|
'translations' => [],
|
|
];
|
|
});
|
|
|
|
add_filter('automatic_updater_disabled', '__return_true');
|