WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Using tax_query changes my post_type query in my WP_Query arguments (3 posts)

  1. Jpyper
    Member
    Posted 2 years ago #

    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:

    'post_type' => 'event'
    		,'tax_query' => array(
    					array(
    						'taxonomy' => 'event-categories'
    						,'field' => 'id'
    						,'terms' => 72
    						,'operator' => 'IN'
    					)
    		)
    		,'order' => 'ASC'
    	);
    $query = new WP_Query( $args );

    and when I remove the tax_query portion I get all my posts, but when I include it I get none. I'm positive I have more than one post with the taxonomy ID of 72. When I look at my print_r($query) with the post type in, I see this:

    WP_Query Object
    (
        [query_vars] => Array
            (
                [post_type] => Array
                    (
                        [0] => media_player
                        [1] => ada_slides
                        [2] => closings
                        [3] => staff
                        [4] => post
                        [5] => page
                    )

    All of my post types are listed except for the one I wanted, event. If I take out tax_query from my args, it looks like this:

    WP_Query Object
    (
        [query_vars] => Array
            (
                [post_type] => event
                [order] => ASC
    ...and so on

    Why would using a tax_query argument seemingly invalidate my post_type argument and instead include all post types but the one I wanted?

  2. Jpyper
    Member
    Posted 2 years ago #

    Plugin problem -> Easy Custom Content Types. I'm contacting the developer.

  3. This problem is resolved by going to Content Types > Settings and checking "Disable Taxonomy Archive Fix".

Topic Closed

This topic has been closed to new replies.

About this Topic