Custom taxonomy shared across two custom post types – url rewrites


I’m using CPT-UI to create my custom post types and taxonomies.

I have two post types – aulocations and uklocations these work and show up as:


Next: these post types share a common taxonomy called ‘events’

I’d like urls to display as:

  • these pages can in turn show the posts that are both in the postype: aulocations or uklocations depending on the base url and in the ‘taxonomy: {event-name}’

Currently when i hit:

/au/events/{event-name} – it redirects back to /events/{event-name} and ignores the post_type

I’ve tried to achieve this by:

1/ wp rewrites

function custom_rewrite_rules() {



add_action('init', 'custom_rewrite_rules');

2/ or via .htaccess

#RewriteRule ^/?au/event/(.*?)?$ /index.php?post_type=aulocations&taxonomy=event&term=$1 [L]
#RewriteRule ^/?uk/event/(.*?)?$ /index.php?post_type=uklocations&taxonomy=event&term=$1 [L]

No luck so far.

, , , Simon 3 months 0 Answers 42 views 0

Leave an answer