These should work for you:
function myplugin_rewrite_tag_rule() {
add_rewrite_rule(
'category/(.+?)/tag/([^/]+)/?$',
'index.php?category_name=$matches[1]&tag=$matches[2]',
'top'
);
add_rewrite_rule(
'category/(.+?)/tag/([^/]+)/page/?([0-9]{1,})/?$',
'index.php?category_name=$matches[1]&tag=$matches[2]&paged=$matches[3]',
'top'
);
}
add_action('init', 'myplugin_rewrite_tag_rule', 10, 0);
The second rule is to support pagination so you can have:
https://example.com/category/healthy-living/relationships/tag/flock
as well as:
https://example.com/category/healthy-living/relationships/tag/flock/page/2/
Note that you don’t need to add a rewrite tag, as it’s already added by core.
Related Posts:
- Is There a Difference Between Taxonomies and Categories?
- What is the difference between a “tag” and a “category”?
- How to display non-hierarchical taxonomy as terms with checkboxes?
- Control term order on a per-post basis
- get all tags from category
- 404 Error On Category and Tags Pages
- Checklist of selected categories
- How to tax query X number of posts related by tag first, then by category if not enough in tag-related
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- Category and tag with same name
- Create subdomains for tags and categories
- Automated adding of one tag to all the posts in a category
- Moving Categories submenu to Media, but still opens Posts menu
- When using get_categories or similar, is it possible to filter results that contain certain Tags as well?
- How to totally get rid of Category in my blog?
- Showing all the posts in one page?
- Deleting All tags except categories Wp database
- Is it possible to put tags and category information in the post as text?
- Script to duplicate categories as tags
- Search by word, category, tag, author
- How to filter archives both by category and tag?
- display most popular tags of category?
- Get tags specific category
- Can paginate_links() be customized for a specific category or tag?
- Any way to assign Post Categories and Tags to Links?
- Category archive page – loop through posts of certain tag (with pagination) – pre_get_posts
- Category vs Tag vs Table
- Custom WP_Query for current category (in category.php)?
- How to find the number of Tags a post has?
- How to not treat categories as tags in feeds
- Are Category or Tag Archive Pages Possible?
- How can I duplicate categories and tags?
- Random post + categories + tags
- Search Posts / Pages with multiple options?
- Display tags from specific category in select fields
- Offline WordPress Application
- Find out which user created a category or tag?
- RSS/XML of all Categories and/or Tags
- Get Tags specific to Category using WooCommerce plugin
- How to make 2 tag feeds show up on 1 page?
- Different templates for different category tags
- Get link which associated with a specific category and tag
- How to get related tags based on a category?
- Needing a snippet for listing category specific tags
- How to list categories within tags?
- How to “group” (categorize) the Pages together?
- Is There a Difference Between Taxonomies and Categories?
- Use Tag input metabox style for Categories
- menu using category and tags
- Custom SQL Query: Get all posts with category id and a concated list of tags on each post
- limit a list of tags to one category [closed]
- Have multiple category queries from the URL been fixed yet?
- Related Tags not in category
- scaleability of tags
- Is there a reason I cannot get the current category in a loop?
- How do I add a tag slug to a category URL to filter posts?
- Show the amount of posts in a tag in a specific category has
- Display all product tags associated with a specific product category
- How replace individual elements in the RSS feed with a single string
- Adding a H1 Tag to Post Tags automatically, but hide the tag? (Same for Category)
- Tags Instead of Category
- Conditional category & tag statement
- Include either name or slug in the include parameter using wp_list_categories?
- How can I filter posts by tag on the fly
- Advanced permalinks structure
- Filter categories/tags to display in multiple metaboxes for selection in back-end
- Editing Loop So It Targets Specific Tags?
- How can I include custom category and tag base in template files?
- Pretty URLs with Categories and Tags
- Autolinking keywords in text with tags
- Maintaining a separate posts page for certain categories and don’t show those on home page
- Are tags different than categories?
- Custom menu with categories and tags
- Show Posts via cat+cat in URL that are in both Categories doesn’t work
- Display all categories but only if they have posts in them that have a specific tag assigned
- Help to display the current categories and tags of a post
- Hide specific category tag on single post page
- Filtering posts in category by tag URL
- echo $category[0]-> cat_name; shows only one category name
- How to show entries related to main category
- When creating category, it creates automatically tag, or, when creating tag, it creates automatically category in same name
- Using heirarchial tags or Custom taxonomies
- Re-coding category-template.php to go to custom URL
- Category and tag urls return 404 error
- How to echo Tags and Categories as plain text
- Tag Menu items based on their categories
- Hide category name using mod_rewrite
- How to exclude category and post_tag taxonomy while displaying custom taxonomy?
- 404 error when i try to search by category or by tag
- How to remove specific categories from tag archives?
- A simple question regarding tags and categories
- Display related posts with same category or same tag return blank
- How can I allow people to ‘subscribe’ to categories?
- htaccess redirect for all categories converted to tags now showing 404
- Loops in category description
- How to create a category or tag available exclusively to the admins and not to the users?
- altering theme – content generated by PAGES not PORTFOLIO
- Search tag within category
- List products from current category
- In my wordpress admin panel Suddenly The Category, tag and featured Image Option are not showing