Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter to skip the fetch_remote_file call #103

Open
ovidiul opened this issue Aug 11, 2021 · 0 comments
Open

Filter to skip the fetch_remote_file call #103

ovidiul opened this issue Aug 11, 2021 · 0 comments

Comments

@ovidiul
Copy link

ovidiul commented Aug 11, 2021

Looking at this line of code

$upload = $this->fetch_remote_file( $url, $post );

it would be useful to add a filter on top of it and a conditional check to maybe defer the remote upload to a user-defined hook.

In our specific case, we are uploading the files ahead of time, and it would be useful to try not to fetch the data again as we could code the results in that specific hook.


$upload = apply_filters( 'wp_fetch_remote_file', false, $url, $post);

if( false === $upload ) {
  $upload = $this->fetch_remote_file( $url, $post ); 
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants