4

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.

4

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');
  • Why did I get -2 ? Is it only because of the link formating ? – Sladix Apr 27 '15 at 9:32
  • 3
    Link-only answers are discouraged, because answers should contain all relevant information in themselves, so add the information to you answer and people will retract their down votes. – Nicolai Apr 27 '15 at 9:42
  • Where is the code that should be added to funtions.php. Without the code your answer is useless and nothing more than a comment :-) – Pieter Goosen Apr 27 '15 at 10:00
  • Is it better this way ? – Sladix Apr 27 '15 at 10:06
  • 1
    Correct yes. :-) – Pieter Goosen Apr 27 '15 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.