• I just installed this plugin to help me improve the search functions on a site I’m working on. Included fields for a couple custom taxonomies in the search form along with the “s” input. That works fine.

    The problem is, now all of my pages which rely on custom get_posts or WP_Query queries started returning everything. I added a line to the function pre_get_posts() like this :

    if (!is_search()) return; //ie only add this processing on search pages

    Seems to function the way I want. I can’t tell if there’s a better way of doing this, though. And… should this plugin be overriding custom queries that include taxonomy queries to begin with?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author scribu

    (@scribu)

    Please paste an example of a custom query that’s causing problems.

    Thread Starter goldenapples

    (@goldenapples)

    My query looks like this:

    $posts = get_posts('category='.$cat.'&location='.$city.'&orderby=date&order=DESC');

    where “location” is a custom taxonomy, and one of the taxonomies I have included in the drilldown widget. But without the hack I mentioned above, this query seems to return results from all “locations”, not just the one passed in the arguments.

    Just wondering if this was intended behavior, and if so, if there’s a better way of overriding it than what I’ve done. Thanks!

    Plugin Author scribu

    (@scribu)

    ‘category’ should be either ‘cat’ (id) or ‘category_name’ (slug).

    Thread Starter goldenapples

    (@goldenapples)

    Thanks. I fixed that one. Still, it was functioning as I expected it to… for now, ‘category’ is maintained for backwards compatability.

    But the result of the query is still the same when I make that fix. Unless I explicitly disable the pre_get_posts function from QMT_Query on everything but search results, it overrides the taxonomy arguments passed in my get_posts query. No big deal, I’ve worked around it though.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Query Multiple Taxonomies] How to keep this from overriding custom get_posts queries’ is closed to new replies.