• I have an issue that has just cropped up.

    I’m running the following query:

    // GET FEATURES
    $args = array(
        'post_type' => 'features',
        'posts_per_page' => 5,
        'tax_query' => array(
            array(
                'taxonomy' => 'regions',
                'field' => 'slug',
                'terms' => $r_term->slug,
            )
        )
    );
    // set query based on the above parameters
    $wp_query = new WP_Query($args);

    Up until yesterday the query was working fine, no problems at all. Now when it runs it seems to pull in random results, i.e. posts that don’t have the relevant taxonomy term (as well as the correct results). I have no idea what is going wrong.

    Any help trouble shooting this would be much appreciated.

    Cheers

    Dave

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter pricey_ZEAL

    (@pricey_zeal)

    Anyone?? I’m not getting anywhere fast with this :[

    Thread Starter pricey_ZEAL

    (@pricey_zeal)

    I’ve just checked out the query being used in the above wp_query

    SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (43,44,45,46,47,48,57,58,59,60,61,62,63,64,65,75) ) AND wp_posts.post_type = 'features' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 5

    If I want posts from just the term_taxonomy_id 75 for example, surely i should only be querying 75?? Where are all the other ids coming from??

    Thread Starter pricey_ZEAL

    (@pricey_zeal)

    After failing to resolve this issue, I restored the website to a previous (working version) since then wordpress 4.01 has managed to install itself and the same issue has arisen. I really need advice on this as I want the latest release of wordpress, but at this moment in time I will be using:

    define('WP_AUTO_UPDATE_CORE', false);

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘tax_query’ is closed to new replies.