Add new ajax_query_attachments_args filter.

props alex-ye.
fixes #24285.

Built from https://develop.svn.wordpress.org/trunk@25279


git-svn-id: http://core.svn.wordpress.org/trunk@25243 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-09-06 15:18:09 +00:00
parent 897ddbd76c
commit 5e0040a6ca

View File

@ -1834,6 +1834,13 @@ function wp_ajax_query_attachments() {
if ( current_user_can( get_post_type_object( 'attachment' )->cap->read_private_posts ) )
$query['post_status'] .= ',private';
/**
* Filter the arguments passed to WP_Query during an AJAX call for querying attachments.
*
* @since 3.7.0
* @param array $query Array of query variables.
*/
$query = apply_filters( 'ajax_query_attachments_args', $query );
$query = new WP_Query( $query );
$posts = array_map( 'wp_prepare_attachment_for_js', $query->posts );