2015-12-02 64 views
0

我正在使用「wp-meta-tags」插件,但每次更新它時,都會使網站崩潰。 如何禁用直接在插件文件中更新檢查。WordPress的 - 如何禁用插件更新檢查?

+0

看到這個插件將幫助你:[禁用特定的插件更新](https://wordpress.org/plugins/block-specific-plugin-updates/) –

+0

我不想爲此使用任何插件。正如我寫的,我需要手動禁用它,並從插件文件只。 – user3351236

+1

我明白了,檢查一下它是否可以幫助你:http://www.thecreativedev.com/disable-updates-for-specific-plugin-in-wordpress/ –

回答

0

function.php

//filter for blocking specific plugin updates 
add_filter('http_request_args', 'wp_prevent_plugin_update_check', 10, 2); 

function wp_prevent_plugin_update_check($r, $url) 
{ 
    $parse_url = parse_url($url); 
    $host  = isset($parse_url['host']) ? $parse_url['host'] : ''; 
    $path  = isset($parse_url['path']) ? $parse_url['path'] : ''; 

    if ($host == 'api.wordpress.org' && $path == '/plugins/update-check/1.1/') 
    { 
     $plugins = json_decode($r['body']['plugins'], true); 
     $update_blocked_plugins = array('plugin_folder/plugin_main_file.php'); 

     foreach ($update_blocked_plugins as $update_blocked_plugin) 
     { 
      if (array_key_exists($update_blocked_plugin, $plugins['plugins'])) 
      { 
       unset($plugins['plugins'][$update_blocked_plugin]); 
      } 
     } 

     $r['body']['plugins'] = json_encode($plugins); 
    } 

    return $r; 
} 

變化plugin_folder這對你的主題添加到您的插件文件夾名稱plugin_main_file.php插件主PHP文件

如果你想添加更多的插件,只是添加到$update_blocked_plugins陣列。

希望這有助於

0

一種更簡單而有效的解決方法是打開你的插件文件,更改版本號爲非常高,這樣的插件,認爲它是由最新的。