The tag has no wiki summary.

learn more… | top users | synonyms

7
votes
1answer
2k views

Multiple relationship for multiple tax_query in WP_Query

I want to use the WP_Query class to filter some of my posts. The problem I facing now is handling the taxonomy query. Normally, the wp_query only handle one relationship for tax_query (either AND or ...
6
votes
1answer
6k views

Custom Taxonomy and Tax_Query

I've been having a lot of trouble getting a WP_Query running with a tax_query on my custom taxonomy. I'm 99.9% sure that my register_taxonomy is correct, as I'm able to tag posts with the right term, ...
4
votes
1answer
5k views

Nested meta_query with multiple relation keys

I am curious whether Wordpress is able to run nested meta_query, with each having different relation keys? As of Wordpress 3.0, tax_query is able to perform this function; I'm wondering whether this ...
3
votes
4answers
9k views

Query posts by custom taxonomy ID

I have a custom post type called portfolio and a custom taxonomy called build-type (acting as categories) I am trying to query portfolio posts by build-type ID e.g. all Portfolio posts in "Hotels" ...
2
votes
1answer
6k views

“tax_query” parameter not working with WP_Query

I have a custom post type called 'episode'. Attached to 'episode' I have a custom taxonomy called 'video_type' that contains two terms: "bonus-footage" and "episode"; "episode" contains two child ...
2
votes
1answer
2k views

How to Get All Taxonomies AND All Terms For Each Taxonomy With Post Count Zero

Is there an easy way of obtaining every registered taxonomy and for each registered taxonomy, get all the terms for that taxonomy, and for each term, get the post count, without actually fetching all ...
2
votes
1answer
132 views

WP_Query tax_query problem

When I call WP_Query with tax query or category__in, I get posts only from first category in array of requested categories. $query = new WP_Query( array( "tax_query" => array( ...
2
votes
2answers
228 views

How to output content based on same custom taxonomy?

I have been trying to output content of all post-types (Posts, Pages and CPTs) based on a term of a custom taxonomy that they must share (meaning if they don't share that particular term, the output ...
2
votes
1answer
441 views

Order posts by (hierarchical custom) taxonomy terms and term children

The scenario a custom post type wiki a (hierarchical) custom taxonomy topics a page template archive-wiki.php The situation Posts show up and get ordered by post_date (which is the default). The ...
2
votes
1answer
148 views

Query all posts in a given taxonomy

For sure it's very simple, but I can not figure out how to do this. I need to query all posts that has a specific taxonomy set. Like this: $query03 = array( 'numberposts' => 5, 'post_type' ...
1
vote
1answer
160 views

pre_get_posts Tax Query not working for custom author page

I am using the theme TwentyTwelve and modified the standard post query in the file author.php with the following code: function wpd_author_query( $query ) { //CODE to set $current_user_name here ...
1
vote
2answers
540 views

Including all terms in wordpress tax_query

I'm a little bit confused, why I can't include all the terms in tax_query automatically? My code: 'tax_query' => array( array( 'taxonomy' => 'city', 'field' => 'slug', ...
1
vote
1answer
1k views

Why is my WP_Query not working when tax_query terms are an array?

I have an issue with a WP_Query for a site I'm building which has me stumped. This works as expected: $package_args = array( 'post_type' ...
1
vote
1answer
646 views

When tax_query used, results disappear (0 =1 produced)

I'm trying to perform a dynamic query that uses a dynamically passed taxonomy and post_type, and displays results accordingly — A user makes a selection from 3 drop-downs on a form, each have a ...
1
vote
2answers
275 views

How to add terms to my tax_query based off of the current post

I need the terms in my tax_query to be the ones from the current post. I am trying to this by using a variable. The value of the variable is given by using the get_terms() function. The problem is ...
1
vote
1answer
551 views

Query Multiple Taxominies Across Multiple Post type's

i have searched and found some aprroved answers to similer questions but nothing i could make work or something exactly like my issue... i have 5 custom post type... each one have its own taxmonies ...
1
vote
1answer
207 views

Multiple, nested tax_query relation

I have been stuck on a particular problem for a while now and have yet to find a way around it. I have custom widgets and for each widget I have added the ability to filter posts based on category ...
1
vote
3answers
69 views

Specify number of posts in my 'tax_query'

I'm showing posts of the term 'football' belonging to the taxonomy 'section', and everything works perfectly but Where can I specify the number of posts I want to show? just like this: 'showposts' ...
1
vote
2answers
509 views

tax_query not working on main query

I'm using the following code to do a tax_query and it doesn't seem to work anymore.. At some point it was working and for the life of me it wont, anymore. <?php global $pf_override; class ...
1
vote
1answer
858 views

Problem with get_posts, tax_query and counting the number of posts

I want to count the number of posts that has simoultaneously 3 different taxonomies. THe code i'm using is this: $products = get_posts(array( 'post_type' => 'products', 'posts_per_page' ...
1
vote
1answer
901 views

search query within custom taxonomy term, post title and meta field

I want to create a search that does: Search within my custom taxonomy - custom-tags search the post title search select meta field ?? dont know search with custom post type - easy part I looked ...
1
vote
1answer
271 views

Using tax_query reverses my post_type argument in a custom WP_Query

I'm using a custom query to pull some posts from a custom post type. I'm having problems with it so I used print_r on my WP_Query object and I found something strange. my query has these arguments: ...
1
vote
0answers
25 views

Wordpress tax_query not showing private posts

When querying posts with the following: $getClientsArgs = array( 'post_type' => 'client', 'showposts' => -1 ); query_posts($getClientsArgs); Private posts are displayed if the person ...
1
vote
1answer
98 views

Hiding taxonomies with no children WP_Query & tax_query

I have this code which has taken over 7 hours to put together through research but the last hours or so I have hit a brick wall! I require the taxonomy title to be hidden if there are no posts ...
1
vote
0answers
27 views

Exclude posts which have any term in a certain taxonomy from the query

I have a custom taxonomy, and for a certain query I am doing, I want to retrieve all posts which do not have any terms of that taxonomy assigned (for example, they are tag-less). At the beginning I ...
1
vote
1answer
135 views

tax_query: What to pass when I want to have all terms?

… $args = array( 'post_type' => 'wr_event', 'posts_per_page' => -1, 'meta_key' => 'event_date', 'orderby' => 'meta_value_num', 'order' => $order, 'meta_value' ...
1
vote
1answer
299 views

Query for custom post type objects in a taxonomy and with a meta value

I want fetch all posts from the post type book in the custom taxonomy book_tags with the meta key lang and the meta value en. My code: <?php $args = array( 'post_type' => 'book', ...
1
vote
1answer
476 views

Using get_posts() with tax_query parameter set isn't working with attachments

I'm working on a project that requires searching for attachments with a given taxonomy-slug pair (in this case, category=javascript). I'm using get_posts() with tax_query set to achieve this, but it ...
0
votes
2answers
476 views

When/why does '$query->get( 'tax_query' );' return empty?

First the code: function itsme_better_editions( $query ) { if ( $query->is_category() && $query->is_main_query() ) { $query->set( 'post_type', array( 'post' ) ); ...
0
votes
2answers
185 views

tax_query not working in template

I have a custom post type called 'product' with a registered taxonomy 'product-type'. I want to display all post from a particular taxonomy from custom post type. In my case I want to display all the ...
0
votes
2answers
749 views

Wordpress tax query use operator LIKE

I have taxonomy color which is associated with a custom post type. I am listing all the post meta and the taxonomy in a table. I have a option in the table to search the posts matching the search ...
0
votes
1answer
2k views

tax_query in get_posts() not working?

I'm trying to print out all the posts within every taxonomy for a custom post type called product (jigoshop products). So i get all of the taxonomies using $cats = get_terms('product_cat');, then i ...
0
votes
1answer
2k views

Conditional arguments for WP_Query and tax_query depending on if $somevar has a value

I've created a new query for a custom post type of 'courses'. Those results are then to be filtered using tax_query, querying 3 custom taxonomies matching 1 or several term ID's. These are passed from ...
0
votes
1answer
155 views

How to get the id or url of the image in an image post?

I have a bunch of image posts and I'd like to get the ID of those images I didn't set a featured image so I can use wp_get_attachment_image_src() to get the urls of various sizes of those images. ...
0
votes
1answer
275 views

Set tax_query conditionally with new WP_Query

I have a page template with a custom query: <? $filter = explode(' ', $_GET['filter']); // "page/?filter=taxonomy+term" $paged = get_query_var('paged') ? get_query_var('paged') : 1; $query = new ...
0
votes
2answers
194 views

How can i simulate “taxonomy__in” in query?

How can I have to set tax_query to get results like 'category__in' => array()? Specifically, I would like to show all the posts that have a term from the city taxonomy with one of these id's: $cities ...
0
votes
1answer
78 views

tax query between operator like

I have a custom post called person and a taxonomy(like tags) called age. As far I have search tax query doesn't seem to support the between operator like meta query does. Is there a way to accomplish ...
0
votes
1answer
125 views

WP_Query tax_query - Show results if child has parent X

I've made a custom search which includes a 3 tier custom taxonomy that looks like this: continent - country - - state The search is formatting in the above way. Here is my problem: Example data: ...
0
votes
1answer
266 views

how to access the $query variable inside taxonomy-xxx.php template file?

In my custom template files, I create query in the following way: <?php $query = new WP_Query(array('post_type' => 'aya-bi-aya','author' => $current_user->ID,'paged' => $paged, ...
0
votes
1answer
202 views

how to use tax_query to apply both terms or one if one is empty

I'm having trouble with getting tax_query to act as a filter for posts. What I would like is to have it so it will display cpt's that have the terms of county and status but also work if terms are not ...
0
votes
1answer
510 views

Exclude post type with pre_get_posts?

I am using pre_get_posts for a custom taxonomy archive display. Now I added a post type 'photo' sharing the same taxonomy with default post type. How can I exclude 'photo' posts being fetched by the ...
0
votes
1answer
254 views

Tax_Query using WP_Query not working

I cannot get this query to work properly. It just renders one post even though I have three posts that are categories in the 'Firm News' and 'Test' categories. Can anyone see a problem with my code? ...
0
votes
2answers
251 views

WP_Query parameter conflict

I am writing a query to retrieve instances of a custom post type I created called "Specialist". In the query I specify a name and more than one taxonomy. I want to retrieve just those specialist which ...
0
votes
1answer
289 views

Tax query not producing any results

I have created a custom post type called 'course' which has 7 posts each being an individual training course. I've also tagged them with individual custom taxonomies 'course_codes' eg. h001, h002, ...
0
votes
1answer
360 views

Show multiple tax_query from 2 or more post_type in a single code

i've been trying with no success to show 2 custom taxonomies from 2 post_type, here's my code: <?php /** * Display a list of the most recent news in 'Avisos' ...
0
votes
1answer
2k views

How to do a particular wp_query taxonomy search

I have added a custom taxonomy called experience to the page post-type, and the taxonomy has terms "vfds" and "plcs" I am trying to create a search where a user can select one or more experience ...
0
votes
2answers
522 views

Query all posts under one taxonomy? Why is my code not working?

I'm trying to show all the posts associated with a Taxonomy (not a term) but it seems to not work. <?php $args = array( 'post_type' => 'projects', 'tax_query' => array( ...
0
votes
1answer
20 views

Include Category With Tax Query

I'm using The Events Calendar plugin but I thought I'd post it here as I believe this particular function works the same as get_posts(). I'm trying to use the function to display only posts from one ...
0
votes
0answers
58 views

Display related posts with same category or same tag return blank

I'm trying to display 4 related posted in the same category or have the same tag with the current post on the single post page. The result is just blank. <?php $rCateogry = ...
0
votes
1answer
53 views

Match two taxonomies to display a specific content

I have a page divided in two bars. The left bar is a side menu, which shows contents for a specific country (ie: if I am in the Mexico page, there are options listing Cancun, Acapulco, Mexico ...