Select Page

WordPress 關閉各項通知,還給使用者一個乾淨的空間

常有WP的使用者抱怨,WP實在有太多無所謂的通知,尤其再安裝了諸多外掛後,每個外掛都會三不五時來個促銷通知,煩不勝煩,這邊提供解決方案,一個是最多人使用的外掛 Disable Admin Notices individually ,另一個是再 functions.php 中撰寫官幣的程式碼,兩個加再一起用更好。

Disable Admin Notices individually

安裝完畢,並且啟用他後,會發現要關閉 Plugins updates nags, Core updates nags 需要 PRO 版本,這時候可以選擇購買並且支持它們,或是能寫程式的朋友們可以自行到 functions.php 撰寫相關程式

functions.php 關閉通知

可以在您的佈景主題下,找到functions.php,打開並且編輯他,加入以下內容即可,可以依照註解,去選擇你要關閉或是打開的通知資訊。

// hide update notifications
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'); //hide updates for WordPress itself
add_filter('pre_site_transient_update_plugins','remove_core_updates'); //hide updates for all plugins
add_filter('pre_site_transient_update_themes','remove_core_updates'); //hide updates for all themes