Query Multiple Taxonomies
QMT rewrite rules (4 posts)

  1. joshuaiz
    Posted 2 years ago #

    I'm having issues with my query URLs and cannot get them to be prettified no matter what I use (rewrite rules, etc).

    Here is a url example:


    I'd like it to be:


    But I would settle for:


    Why am I getting the brackets [ ] and taxonomy id (23) instead of the taxonomy term?

    I'm using /%postname%/ structure and not using any SEO plugin.

    When I run the qmt debug function:

    function qmt_debug() {
      global $wp_query;
      echo '<pre>';
      echo '</pre>';
    add_action( 'template_redirect', 'qmt_debug', 8 );

    I get this:

        [tax_query] => Array
                [0] => Array
                        [taxonomy] => pa_meal_type
                        [terms] => Array
                                [0] => 23
                        [field] => term_id
                        [operator] => IN

    That does not look good to me although I don't know enough about rewrite rules/regex to know what is going on.

    Any ideas?


  2. camilodelvasto
    Posted 2 years ago #

    Hi joshuaiz,

    I'm having the same issue and don't have a clue what to do about it. Did you find a solution?

  3. nysos3
    Posted 2 years ago #

    I was able to get the URLs to show as http://example.com/?foo=bar
    the only issue is that when selecting multiple items for the same taxonomy, rather than putting both terms under one key, it created the same key multiple times, which left me with http://example.com/?foo=bar&foo=bar2 in which case only the last key works.

    Right now I'm sticking with the qmt[$taxonomy][], because it seems to be the only way to query the same taxonomy multiple times without re-writing a lot of the plugin.

    http://stackoverflow.com/questions/10678918/can-i-have-multiple-get-with-the-same-key-different-values should explain why we have to use [], and as for it being prefaced with qmt, that's just a way for the foreach loop to go through all GET variables.

    At a bare minimum, if you'd like to show qmt[$taxonomy][]=slug instead of id, then change term_id to slug on line 14 and 77 in core.php and on line 177 in walkers.php.

    You can also change qmt to be something like "tax" by changing qmt[$this->taxonomy][] to tax[$this->taxonomy][] on line 176 in walkers.php and $_GET['qmt'] to $_GET['tax'] on line 7 and 10.

    I haven't tested it, but you may even be able to change that $_GET['qmt'] to just $_GET and remove "qmt" from of 'name' => "qmt[$this->taxonomy][]" to get rid of that qmt url piece all together. Only issue is the plugin would then look at any get variable set by anything and try to parse it.

    Regardless, I'm just posting the various things I've tested. At the very least you can get slugs in the query and do a url re-write from there. Since I'm facing this issue as well, I'll post back if I decide to take on regex/re-writes.

  4. camilodelvasto
    Posted 2 years ago #

    I ended up modifying it completely. Check http://wordpress.org/support/topic/query-taxonomies-and-custom-fields?replies=13 hope that helps somebody.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Query Multiple Taxonomies
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic