I'm trying to filter the attachments when the user tries to set a featured image for the current post, but this affects all the ajax_query_attachments_args
hook requests, like the one in the upload.php
page.
Is there any way to detect that the ajax_query_attachments_args
request was triggered by the Set featured image link in the post edit page?
Note:
I know that the $SERVER['HTTP_REFERER']
would be useful in this case, but the post edit page has another Add Media button that uses the same ajax_query_attachments_args
hook where I don't need to apply the same filters with it.
wp.media.featuredImage
Javascript object to pass a custom param to the$_REQUEST
object with no luck. I'm always receiving this request:$_REQUEST => ['action' => 'query-attachments', 'post_id' => '61', 'query' => [ 'post_mime_type' => 'image', 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => '80', 'paged' => '1']]