Looper empty when using multiple terms and types

So I have a looper populating a grid. I am pulling “regular” posts and “events” which is a CPT created by Modern Events Calendar. No problem so far.

Each post type has categories, and in some cases, they mirror each other. (For instance there is a “Women’s” post category and a “Women’s” event cat.)

When I add the post cat to the looper, it obviously only pulls the posts, not the events. When I then add the event category, it pulls nothing. Even loses the posts it was pulling before. I’ve unchecked the “Must have all selected terms”, hoping that would make the “and” operators into “or” operators, and that hasn’t helped.

So what’s the play here? Essentially I need to craft a looper that pulls 1 category from each post type and mixes them sorting by publish date descending. Doesn’t seem like too much of an edge case.

Any ideas? What am I doing wrong?

I suppose another option if I can’t get the query builder to work like I need, I can use the query string option, but I can’t figure out the syntax for “or” operations and using multiple conditions there.

Can you tell me what the syntax would be for PostType1 or PostType2 with Cat1 or Cat2?

Hi @MintCondition,

Thanks for reaching out!

Just for future topics, self responding or bumping your post pushes it back in our Queue system so it takes longer to respond to.

To better help you with your issues, we need to check your how you set up your loopers. To do that, please give us the following information in a Secure Note.

  • WordPress Login URL
  • Admin level username and password

You can find the Secure Note button at the bottom of your posts.

Thank you.

Provided in secure

Hi @MintCondition,

I have created a new page and created the same condition in the Query Builder option of the Looper Provider. I would request you to check the same and try to replicate it. Please remember to mention the number of posts you want to show.

Please find the test page URL in the secure note.
Hope that helps.


That pulls ANY categories of posts and events, which is not what I need. As mentioned above, I need to restrict to one category in each post type. Please see info in first post.

Hi @MintCondition,

You can specify the specific taxonomies into the Query Builder to the Taxonomies option. I would suggest you go through the following documentation on how you can set the attribute values into the Query Builder of Looper Provider.

I would also suggest you go through the following videos that explain the Looper Provider.

Please find the screenshot describing the Taxonomies settings in the given screenshot.

Hope this helps.

This is becoming frustrating. You are not reading my posts. I have (I think) done all of that. If you checked the page I pointed at, you would see that the loop is set exactly as you say it should be. (See screenshot below)

I have tried renaming categories, changing slugs, even using brand new categories. If I choose one category from Posts and a second from Events, the loop is BLANK. In fact, if you had looked at the page you seem to have grabbed the screenshot from, you would see that the loop isn’t working even there. The grid cells (looper consumers) are blank and not pulling anything from the loop. (see second screenshot below). I’ve also disabled relevant plugins, and provided you with admin access to the site. I have confirmed this behavior on another, completely empty site by creating a new post type, assigning categories and trying to mix them in a loop to the same results (empty loop).

I’m suspecting there may be a bug?

I’m getting frustrated that it takes you so long to respond and when you do it’s with irrelevant details and the issue is not fixed. This issue has been open for almost a week at this point and I’m no closer to a solution than I was at the beginning.

Howdy, @MintCondition! I want to apologize for the delay in getting you a response that directly addresses your situation. I completely understand that frustration and we continually work with our team to ensure that we are always improving with this regard. It’s never perfect, but we always strive to do better. :slight_smile:

Now, on to your particular issue. If I’m reading through your particular situation, you basically have a situation where you have both Posts and Events that each have their own Women’s terms associated with each of these post types (so Posts have the standard “Category” term applied, while Events have their own Event-specific term). So you’re wanting to pull in any Post or Event that might have its own respective “Women’s” term applied, correct?

I attempted to replicate this setup locally using Posts and Products from WooCommerce, just to test pulling in multiple post types and then filtering it down by a specific term unique to each. After attempting this with the Query Builder, it does seem that there is a bug related to this functionality. If you specify multiple post types in the Posts control and then go to the Taxonomies control and specify one term from your Posts and one term from another Custom Post Type, by default it should treat these as an OR relationship, meaning that it should pull in any Post with its associated term OR any of the Custom Post Type with its associated term. WordPress’ own documentation on the WP_Query class seems to indicate that this should be the default relationship when using a tax_query, but I think that the added complexity here of managing this expectation across multiple Post Types is what is creating the issue here.

So we have gone ahead and fixed this bug in our systems by explicitly defining the relation for multiple tax_query definitions to be OR unless the Must have all selected terms checkbox is selected in the Taxonomy control, in which case it would change to AND. This fix will go out in our next release cycle, which is scheduled to be put out sometime in March. I have tested this change locally and can confirm it appears to be working as expected.

All that being said, I certainly didn’t want to leave you waiting until then to get a working solution in place, so I took some time to try and get a working Query String for you, which you could drop in and get working. To do this, I used a technique that I outlined in a comment for another user recently who was needing to achieve a particular result via a Query String, please take a moment to review this when possible for more context:

Now, I do not have Modern Events Calendar installed currently, so I could not reference this in my tests. However, the concept of referencing multiple Post Types and their respective terms remains, so for my example code you will see me referencing the product Custom Post Type for WooCommerce’s products and their product_cat taxonomy respectively. Ultimately, this seemed to work for me:

$query = array(
  'post_type'           => array( 'post', 'product' ),
  'post_status'         => 'publish',
  'ignore_sticky_posts' => 1,
  'posts_per_page'      => 4,
  'orderby'             => 'date',
  'order'               => 'DESC',
  'tax_query'           => array(
    'relation' => 'OR',
      'taxonomy' => 'category',
      'field'    => 'name',
      'terms'    => 'Art Deco',
      'operator' => 'IN',
      'taxonomy' => 'product_cat',
      'field'    => 'name',
      'terms'    => 'Music',
      'operator' => 'IN',

var_dump( http_build_query( $query ) );

Which yielded the result of:


What I’m doing here which you can see from our $query variable is specifying our two post_type values in the associated array(), and then in my tax_query below I have the relation set to OR, and then beyond that I have my two taxonomies and their respective terms being referenced across these Post Types. If you don’t mind the eye strain, you could try just parsing the string I’ve provided above and swapping out my values for your necessary values to get it working for you, haha. Alternately, you can use the code provided in the first snippet, change the values accordingly, and place it in your functions.php file to get the output. This might be a little easier to troubleshoot some things as you will need to play around with the values to ensure you’re referencing the right Post Types and their respective taxonomies.

We apologize again for any delays in getting this information to you and hopefully all of this should get you pointed in the right direction moving forward!

It’s great to know I’m NOT crazy. It really wasn’t working! =) I’m glad to know you figured it out and got it working in a future release.

I did manage to get this working using a similar method. The actual code I used came from someone on the Pro Theme & X Theme users group on Facebook. He helped me craft the custom filter and helped me figure out how I could pass parameters using the JSON params so I could use the same filter for multiple similar queries (in my case, I actually needed to repeat the query over and over pulling loops for Women, Men, Children, etc.)

One recommendation would be expanding the docs on the custom filter and parameters sections of your help docs. I read them several times and for my life could not figure out how to make them apply to my situation. Maybe a few more detailed examples would help.

Thanks for the response!

No problem, @MintCondition! I’m just glad to know you’re finally sorted here. That is a good suggestion to expand upon the docs examples and showcase just a few more use-cases, because there is indeed a lot that can be done with the Custom Looper Provider. Just in case you haven’t had a chance to see them, we did release a couple videos that walked through these in a little more detail on our channel. I did one here where the Custom Looper Provider is discussed in more detail around the 8:33 mark:

And another one of our developers (@alexander) did a much more exploratory and experimental video seeing just how far users can take this Provider Type:

Just thought I would share those resources with you in case you hadn’t had a chance to see them, or for anyone else who might stumble across this thread. Thanks again and have a wonderful weekend!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.