wp_edit_attachments_query

Executes a query for attachments.

Description

(array) wp_edit_attachments_query( (bool) $q = false ); 

An array of WP_Query arguments can be passed in, which will override the arguments set by this function.

Returns (array)

Parameters (1)

0. $q — Optional. (bool) => false
Array of query variables to use to build the query or false to use $_GET superglobal.

Usage

  1. if ( !function_exists( 'wp_edit_attachments_query' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/post.php'; 
  3.  
  4. // Array of query variables to use to build the query or false to use $_GET superglobal. 
  5. $q = false; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_edit_attachments_query($q); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/post.php  
  1. function wp_edit_attachments_query( $q = false ) { 
  2.  
  3. $post_mime_types = get_post_mime_types(); 
  4. $avail_post_mime_types = get_available_post_mime_types( 'attachment' ); 
  5.  
  6. return array( $post_mime_types, $avail_post_mime_types );