I’ve a server and I want to block all the WordPress Sites Updates Notification (more than 150).

I know there is a option in wp-config.php but I want to block all the updates. I put in hosts api.wordpress.org but it keeps showing the update bar.

1 Answer
1

Blocking the server from your hosts to prevent auto updating won’t hide notifications in the back office.

You have to add some code in your functions.php file.

The answer you are looking for is perfectly explained here

You should add these 3 portions of code at the bottom of you functions.php file :

The first one will disable wordpress core update notifications :

add_action('after_setup_theme','remove_core_updates');
function remove_core_updates()
{
 if(! current_user_can('update_core')){return;}
 add_action('init', function(){remove_action( 'init', 'wp_version_check' )}),2); //Thanks to Pieter Goosen, don't use create_function() as described in the link above
 add_filter('pre_option_update_core','__return_null');
 add_filter('pre_site_transient_update_core','__return_null');
}

The second one will prevent plugins update notifications :

remove_action('load-update-core.php','wp_update_plugins');
add_filter('pre_site_transient_update_plugins','__return_null');

Finally, you still need to tell wordpress to use the “remove_core_updates” functions on several actions by adding this last piece of code :

function remove_core_updates(){
global $wp_version;return(object) array('last_checked'=> time(),'version_checked'=> $wp_version,);
}
add_filter('pre_site_transient_update_core','remove_core_updates');
add_filter('pre_site_transient_update_plugins','remove_core_updates');
add_filter('pre_site_transient_update_themes','remove_core_updates');

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *