最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

categories - How to remove parent category from child category url using wordpress rewrite rule?

programmeradmin1浏览0评论

I am trying to remove parent category from the child category but nothing happens. I have a website made with the use of EDD. currently i have categories like below:

  • angular-templates
  • react-templates
  • bootstrap-templates

In each categories, there are sub-categories/child-categories as below:

angular-templates

  • angular-1
  • angular-2
  • angular-3

now if i go to my sub-category, url displays as below:

http://admin-pc/mysite/templates/category/angular-templates/angular-3/

And i want to remove angular-templates or whatever is the category name in url to remove and display url as below:

http://admin-pc/mysite/templates/category/angular-3/

Is it possible with add_rewrite_rule()?

I have achieved what i want with str_replace, but that will affect site's SEO, so that's not possible.

I am trying to remove parent category from the child category but nothing happens. I have a website made with the use of EDD. currently i have categories like below:

  • angular-templates
  • react-templates
  • bootstrap-templates

In each categories, there are sub-categories/child-categories as below:

angular-templates

  • angular-1
  • angular-2
  • angular-3

now if i go to my sub-category, url displays as below:

http://admin-pc/mysite/templates/category/angular-templates/angular-3/

And i want to remove angular-templates or whatever is the category name in url to remove and display url as below:

http://admin-pc/mysite/templates/category/angular-3/

Is it possible with add_rewrite_rule()?

I have achieved what i want with str_replace, but that will affect site's SEO, so that's not possible.

Share Improve this question asked Feb 12, 2020 at 7:46 Vishal BhattVishal Bhatt 1413 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Please check if any of the solutions work for you. There are a few ways we can try to achieve this.

Through WP Permalinks Go to Settings >> Permalinks and select Custom and enter: /%category%/%postname%/ Next set your Category Base to .

Through Yoast Plugin Go to Yoast SEO Select advanced Click on the tab permalinks at the top Check Strip the category base (usually /category/) from the category URL

Use Remove Category Url Plugin

发布评论

评论列表(0)

  1. 暂无评论