Support » Plugin: Query Multiple Taxonomies » QMT rewrite rules

  • 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:[pa_meal_type][]=23&qmt[pa_brand][]=34

    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?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi joshuaiz,

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

    I was able to get the URLs to show as
    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 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. 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.

    I ended up modifying it completely. Check hope that helps somebody.

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