TransWikia.com

Mixed unrelated taxonomy in permalink

WordPress Development Asked by Vauneen on November 28, 2021

we have a situation where we want to build permalinks using mixed (unrelated, ie not hierarchical) taxonomies in permalinks on a wordpress site.

and we dont want the taxonomy name in the actual link.

So what we want is this:

example.com/residential/for_sale/sandton

where:

residential = cpt_property_type

for_sale = cpt_property_status

sandton = cpt_property_suburb

and then an archive of posts filtered by those criteria at each node.

Has anyone seen or done this before?
We thought we’d find a plugin that would do it, but no luck yet.
We’ve tried these plugins:

  • Custom Permalinks
  • Permalinks Customizer
  • Permalink Pro
  • Custom Post Type Permalinks

We though we’d need some kind of rule rewriting: (at least as start)

function custom_rewrite_rules() {
    add_rewrite_rule('^properties_type/(.*)/properties_status/(.*)?', 'index.php?properties_type=$matches[1]&properties_status=$matches[2]', 'top');
}

add_action('init', 'custom_rewrite_rules');

But that just sends us to the home page?
Please can someone point us in the right direction 🙂

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP