ajax_query_attachments_args
Filter HookDescription
Filters the arguments passed to WP_Query during an Ajax call for querying attachments.Hook Information
File Location |
wp-admin/includes/ajax-actions.php
View on GitHub
|
Hook Type | Filter |
Line Number | 3077 |
Hook Parameters
Type | Name | Description |
---|---|---|
array
|
$query
|
An array of query variables. |
Usage Examples
Basic Usage
<?php
// Hook into ajax_query_attachments_args
add_filter('ajax_query_attachments_args', 'my_custom_filter', 10, 1);
function my_custom_filter($query) {
// Your custom filtering logic here
return $query;
}
Source Code Context
wp-admin/includes/ajax-actions.php:3077
- How this hook is used in WordPress core
<?php
3072 *
3073 * @see WP_Query::parse_query()
3074 *
3075 * @param array $query An array of query variables.
3076 */
3077 $query = apply_filters( 'ajax_query_attachments_args', $query );
3078 $attachments_query = new WP_Query( $query );
3079 update_post_parent_caches( $attachments_query->posts );
3080
3081 $posts = array_map( 'wp_prepare_attachment_for_js', $attachments_query->posts );
3082 $posts = array_filter( $posts );
PHP Documentation
<?php
/**
* Filters the arguments passed to WP_Query during an Ajax
* call for querying attachments.
*
* @since 3.7.0
*
* @see WP_Query::parse_query()
*
* @param array $query An array of query variables.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-admin/includes/ajax-actions.php
Related Hooks
Related hooks will be displayed here in future updates.