fix: add require_once to `file.php`

This commit is contained in:
vnmedeiros 2022-08-02 11:37:09 -03:00
parent 7e01e39d13
commit 3b88491708
1 changed files with 15 additions and 12 deletions

View File

@ -104,7 +104,10 @@ class Media {
* @return string the file path
*/
public function save_remote_file($url) {
$filename = download_url($url, 900);
// Include file.php
require_once( ABSPATH . 'wp-admin/includes/file.php' );
$filename = \download_url($url, 900);
if( is_wp_error($filename) ) {
throw new \Exception( "[save_remote_file]:" . implode("\n", $filename->get_error_messages()));
}