WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a number of regular posts and pages in a regular category called "Featured". I have also installed a plugin called "Event Organizer" that creates its own custom post type called "Event" and has its own interface for creating plugin-specific categories.

Anyways, what I've created is a basic highlight slider using a query to pull in the featured category posts and pages (I enabled categories in my pages) as well as the event posts. This is the query:

  'post_type' => 'any',
  'showposts' => $featured_num,
  'order' => 'DESC',
  'tax_query' => array(
    'relation' => 'OR',
        'taxonomy' => 'category',
        'field' => 'slug',
        'terms' => 'featured'
        'taxonomy' => 'event-category',
        'field' => 'slug',
        'terms' => 'featured-event',
$my_query = new WP_Query($args);

The problem is that everything works fine on my local testing environment but absolutely refuses to work on my web host. In my local testing environment both the "featured" posts and pages are pulled up AS WELL AS the event custom posts. On my web host only the event posts show. If I switch "post type" to array('post','page') I get the featured posts and pages but lose the event posts.

share|improve this question
have you tried array( 'post', 'page', 'event' )? look at the query on both setups to see if there are differences- add print_r( $my_query ) and inspect the SQL generated in both cases. – Milo Mar 24 '13 at 5:34
Add debugging information please. – s_ha_dum Mar 24 '13 at 13:35

These scenarios become much easier if you use plugins like posts2posts to establish a relation (for example featured posts to this page) and then pull them easily in the context

share|improve this answer


'post_status' => array('featured','publish') 


'post_type' => array('post','page','event')

but if Event post type slug is 'event'

Also it's a known issue that 'post_type' => 'any' doesn't work!

share|improve this answer
I'm looking at /wp-includes/query.php at lines 2897-2902 and see that it does indeed officially support using the "any" post_type; if supplied, it enumerates through known post types using get_post_types() and would potentially fail if it couldn't find any (hence the AND 1=0 SQL it injects). This said, I've never tried this and didn't even believe this was possible using standard WP queries. – Justin Bell Oct 4 '14 at 15:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.