Problem with custom post query
-
My Goal:
I want the plugin to query all images in my media library with the custom taxonomy,
attachment_category
, equal to the sluggallery
. (I have already set this up in my theme’sfunctions.php.
)What I have Done:
I built a WordPress page that correctly queries the images I want. The query uses the following array:
array( 'post_type' => 'attachment', 'post_mime_type' =>'image', 'post_status' => 'inherit', 'posts_per_page' => -1, 'tax_query' => array( array( 'taxonomy' => 'attachment_category', 'terms' => 'gallery', 'field' => 'slug', ) ) )
I also use
http_build_query();
to echo convert this multilevel array to a query string. I use this string to query the posts I want the plugin to display. This is the query string:post_type=attachment&post_mime_type=image&post_status=inherit&posts_per_page=-1&tax_query[0]taxonomy=attachment_category&tax_query[1]terms=gallery&tax_query[2]field=slug
What Happens:
The plugin simply displays all the images in my media library, not the images with my custom taxonomy, only.
Any ideas on how to get the plugin to display only the images with the custom taxonomy?
The page I need help with: [log in to see the link]
- The topic ‘Problem with custom post query’ is closed to new replies.