Is there a way to force WordPress to overwrite plugin files on installation?

There are some 3rd party WordPress plugins that do not support automatic updates. So, if you have v1.0 of a plugin already installed and you try to install a new version (e.g. v1.1), you will end up getting the message:

Destination folder already exists. /home/.../.../...

This leaves two options, neither of which i’d like to use: Uninstall & re-install the plugin, or manually upload the new files via FTP.

In /wp-admin/includes/class-wp-upgrader.php line 428 I see this code:

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);

    ...

Is it possible to add a line to my theme’s functions.php file to re-declare ‘clear_destination’ as true, and thereby forcing WordPress to overwrite plugin files when I upload them?

Thanks

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)