Wordpress 取消煩人的新版本及更新通知 - 吉姆的電腦閣誌

吉姆的電腦閣誌

HTML5,Jquery,PHP,FreeBSD分享教學。電腦是用來節省時間及提升樂趣,不是用來把人綁住的。隨心而行,順著生命的脈動重新創造屬於自己的生活。

Breaking

Home Top Ad

Responsive Ads Here

Post Top Ad

Responsive Ads Here

2015-12-09

Wordpress 取消煩人的新版本及更新通知

取消煩人的新版本通知
近來Wordpress成為大眾化的架站工具,只要會好好利用,不論是部落格或商務網,都能省下我們很多時間,因為全世界有太多熱心(時間多到不行又聰明)的網友,努力寫外掛並免費提供使用,不過漸漸的仍偏向免費版的功能受限,付費才能使用專業版本的趨勢。但是在Wordpress的後台就是會自動檢查新版本的Wordpress或外掛新版本,有時不小心按了升級,可能會引起無法挽救的後果,所以要找方法取消這個機制。

第一個步驟就是要找到佈景主題目錄下的functions.php,如果沒有這個檔案則自行建立即可自動讀取。接著就是在functions.php檔案後面加上以下程式碼:

  1. 取消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');
    }
    

    screenshot-spicyamei twbest biz 2015-12-08 19-06-30
    screenshot-spicyamei twbest biz 2015-12-08 19-08-18

  2. 取消外掛(plugings)新版本通知


    
    /*------------------------------------------------------------
     * 取消外掛(plugings)新版本通知
     *------------------------------------------------------------*/
    remove_action('load-update-core.php','wp_update_plugins');
    add_filter('pre_site_transient_update_plugins','__return_null');
    

    screenshot-spicyamei twbest biz 2015-12-08 19-03-16
    screenshot-spicyamei twbest biz 2015-12-08 19-03-43

  3. 取消所有(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');
    

    screenshot-spicyamei twbest biz 2015-12-08 19-01-28
    screenshot-spicyamei twbest biz 2015-12-08 19-00-54

沒有留言:

Post Bottom Ad

Responsive Ads Here

Pages