有一些不支持自動更新的第三方WordPress插件。所以,如果你已經安裝了一個插件的v1.0和您嘗試安裝新版本(例如V1.1),你最終會得到消息:有沒有辦法強制Wordpress在安裝時覆蓋插件文件?
Destination folder already exists. /home/.../.../...
這留下兩個選擇,既不我想使用:卸載&重新安裝插件,或通過FTP手動上傳新文件。
在/wp-admin/includes/class-wp-upgrader.php線428我看到這個代碼:
public function install_package($args = array()) {
global $wp_filesystem, $wp_theme_directories;
$defaults = array(
'source' => '', // Please always pass this
'destination' => '', // and this
'clear_destination' => false,
'clear_working' => false,
'abort_if_destination_exists' => true,
'hook_extra' => array()
);
$args = wp_parse_args($args, $defaults);
...
是否可以添加一行到我的主題的functions.php文件重新聲明'clear_destination'爲true,從而迫使Wordpress在我上傳插件文件時覆蓋它們?
謝謝