Add new ajax_query_attachments_args filter.

props alex-ye.
fixes #24285.


git-svn-id: https://develop.svn.wordpress.org/trunk@25279 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2013-09-06 15:17:35 +00:00
parent 93cfccac2d
commit 69a949d160
1 changed files with 7 additions and 0 deletions

View File

@ -1834,6 +1834,13 @@ function wp_ajax_query_attachments() {
if ( current_user_can( get_post_type_object( 'attachment' )->cap->read_private_posts ) ) if ( current_user_can( get_post_type_object( 'attachment' )->cap->read_private_posts ) )
$query['post_status'] .= ',private'; $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 ); $query = new WP_Query( $query );
$posts = array_map( 'wp_prepare_attachment_for_js', $query->posts ); $posts = array_map( 'wp_prepare_attachment_for_js', $query->posts );