• I discovered when trying to pull a site down to my local dev machine that this plugin doesn’t handle missing media files and silently fails.

    This is because it tries to do a get_attached_file call to recover the path information for the file you want to replace.

    Around line 70 of upload.php for the plugin, put this:

    $ulPath = wp_get_upload_dir();
    if(strpos($current_file, $ulPath['basedir']) === FALSE){
            $current_file = $ulPath['basedir'] . str_replace($ulPath['baseurl'],'',$current_guid);
    }
    unset($ulPath);
    

    And it’ll catch missing files and allow you to replace them just fine. Would be nice to have this checked over and added to the next release.

    • This topic was modified 7 years, 11 months ago by denyerec.
  • The topic ‘[Feature] Handle Missing Files (Code supplied)’ is closed to new replies.