Disable update wordpress core, plugin and theme
02/09/2020 01:19 3477
Điều này là cần thiết, việc này đôi lúc sẽ gây ra lỗi website đột xuât do lỗi mạng đang update lở dở chẳng hạn, đường truyền đến hosting có vấn đề chẳng hạn sẽ dẫn đến việc update không hoàn thành gây ra lỗi site. Sau đây tui xin chia sẽ code để disable
1.Disable update wordpress
Mở file wp-config.php lên thêm vào các dòng code sau:
|
//disable update wordpress core define( 'WP_AUTO_UPDATE_CORE', false ); |
2.Disable update plugin và theme
Mở file functions.php thêm code sau vào
|
//Disable update plugins add_filter( 'auto_update_plugin', '__return_false' ); //Disable update themes add_filter( 'auto_update_theme', '__return_false' ); |
3. Ẩn thông báo update
|
add_filter('pre_site_transient_update_core',array($this,'remove_core_updates')); //hide updates for WordPress itself add_filter('pre_site_transient_update_plugins',array($this,'remove_core_updates')); //hide updates for all plugins add_filter('pre_site_transient_update_themes',array($this,'remove_core_updates')); //hide updates for all themes function remove_core_updates(){ global $wp_version;return(object) array('last_checked'=> time(),'version_checked'=> $wp_version,); } |
Các bài viết khác có thể hữu ích với bạn