retesere20

---- disable autoamtic updated wordpress

Jan 9th, 2019
77
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //disable CORE updates
  2.  
  3. /*
  4. // Automatic Updated (https://codex.wordpress.org/Configuring_Automatic_Background_Updates )
  5. // 0=>enable WP AUTO UPDATE, 1=>disabled AUTO UPDATE 2=> disable, plus remove "UPDATE is available" notification
  6. define ('DISABLE_CORE_UPDATES' , 0); define ('DISABLE_PLUGIN_UPDATES', 0); define ('DISABLE_THEME_UPDATES', 0);
  7. //add_filter( 'automatic_updater_disabled', '__return_true' ); // DISABLE all automatic updates
  8.  
  9.  
  10.  
  11. function removeUPD_FUNC() { global $wp_version; return(object) array('last_checked'=> time(),'version_checked'=> $wp_version,); }
  12. if (defined('DISABLE_CORE_UPDATES')){
  13. if(definedVALUE('DISABLE_CORE_UPDATES')==1) { add_filter( 'auto_update_core', '__return_false' ); }
  14. elseif(definedVALUE('DISABLE_CORE_UPDATES')==2) { add_filter( 'auto_update_core', '__return_false' ); add_action('after_setup_theme','remove_core_updates'); }
  15. //else, just send me mail on update
  16. else{ } //apply_filters( 'auto_core_update_send_email', true);
  17.  
  18. function remove_core_updates() {
  19. if(!current_user_can('update_core')){return;}
  20. add_action('init', create_function('$a',"remove_action( 'init', 'wp_version_check' );"),2);
  21. add_filter('pre_option_update_core','__return_null');
  22. add_filter('pre_site_transient_update_core','__return_null'); //add_filter('pre_site_transient_update_core','removeUPD_FUNC');
  23. }
  24. }
  25.  
  26. // to disable PLUGIN updates
  27. if (defined('DISABLE_PLUGIN_UPDATES')){
  28. if(definedVALUE('DISABLE_CORE_UPDATES')==1) { add_filter( 'auto_update_plugin', '__return_false' ); }
  29. elseif(definedVALUE('DISABLE_CORE_UPDATES')==2) { add_filter( 'auto_update_plugin', '__return_false' );
  30. remove_action('load-update-core.php','wp_update_plugins');
  31. add_filter('pre_site_transient_update_plugins','__return_null'); //add_filter('pre_site_transient_update_plugins','removeUPD_FUNC');
  32. }
  33. }
  34.  
  35. // to disable THEME updates
  36. if (defined('DISABLE_THEME_UPDATES')){
  37. if(definedVALUE('DISABLE_THEME_UPDATES')==1) {add_filter('auto_update_theme', '__return_false' ); }
  38. elseif(definedVALUE('DISABLE_THEME_UPDATES')==2) {add_filter('auto_update_theme', '__return_false' ); add_filter('pre_site_transient_update_themes', 'removeUPD_FUNC'); }
  39. }
  40. */
RAW Paste Data