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.

  • 3
    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, 2013 at 5:34
  • 1
    Add debugging information please.
    – s_ha_dum
    Mar 24, 2013 at 13:35

2 Answers 2


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



'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!

  • 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. Oct 4, 2014 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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