Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End wordpress tax_query issue

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #189402
    pricey_ZEAL
    Participant

    Hello everyone,

    I have a wordpress website that until now has had no issues. Just recently after migrating to another server I have encountered a strange problem, and, am finding it really difficult to solve.

    I have the following wp_query

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

    Now this was working fine before the website was moved, now, however, this query seems to be querying a lot of stuff unrelated to the region with field id = 75 – other ids seems to be creeping into the query. I have a number of tax_queries throughout the site all of which seem to be suffering the same problem.

    Any help Re. this would be much appreciated.

    Dave

    #189416
    Senff
    Participant

    According to documentation, the field has to be one of these:
    – ‘term_id’
    – ‘name’
    – ‘slug’

    I’m not too familiar with it, but maybe try replacing:

    ‘field’ => ‘id’,

    with:

    ‘field’ => ‘term_id’,

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.