I know how to query posts with my custom query var, but I am trying to rewrite the following URL from this...
https://www.fashionavocado.com/category/healthy-living/relationships/?tag=flock
to this...
https://www.fashionavocado.com/category/healthy-living/relationships/tag/flock
I can't seem to combine the pre-existing category/subcategory with the tag.
Here's some code I started with
function myplugin_rewrite_tag_rule() {
add_rewrite_tag( '%tag%', '([^&]+)' );
add_rewrite_rule( '^tag/([^/]*)/?', 'index.php?tag=$matches[1]','top' );
}
add_action('init', 'myplugin_rewrite_tag_rule', 10, 0);
I know this won't work because I need the category parameter as a query var.