近來Wordpress成為大眾化的架站工具,只要會好好利用,不論是部落格或商務網,都能省下我們很多時間,因為全世界有太多熱心(時間多到不行又聰明)的網友,努力寫外掛並免費提供使用,不過漸漸的仍偏向免費版的功能受限,付費才能使用專業版本的趨勢。但是在Wordpress的後台就是會自動檢查新版本的Wordpress或外掛新版本,有時不小心按了升級,可能會引起無法挽救的後果,所以要找方法取消這個機制。
第一個步驟就是要找到佈景主題目錄下的functions.php,如果沒有這個檔案則自行建立即可自動讀取。接著就是在functions.php檔案後面加上以下程式碼:
取消Wordpress官方新版本通知
/*------------------------------------------------------------ * 取消Wordpress官方新版本通知 *------------------------------------------------------------* / add_action('after_setup_theme','remove_core_updates'); function remove_core_updates() { if(! current_user_can('update_core')){return;} add_action('init', create_function('$a',"remove_action( 'init', 'wp_version_check' );"),2); add_filter('pre_option_update_core','__return_null'); add_filter('pre_site_transient_update_core','__return_null'); }
取消外掛(plugings)新版本通知
/*------------------------------------------------------------ * 取消外掛(plugings)新版本通知 *------------------------------------------------------------*/ remove_action('load-update-core.php','wp_update_plugins'); add_filter('pre_site_transient_update_plugins','__return_null');
取消所有(Wordpress,plugins,theme)新版本通知
/*------------------------------------------------------------ * 取消所有(Wordpress,plugins,theme)新版本通知 *------------------------------------------------------------*/ 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');
沒有留言:
張貼留言