0

My Settings > Permalinks is set to /%category%/%postname%/. Thus blog posts have URLs like example.com/category12/article1. I would like to keep this permalink structure for most articles.

Which PHP function should I modify (I'll override it in the theme functions.php) to set an empty slug for a specific category named empty, and only for this one? I'd like articles of this precise category empty to have URLs like example.com/article2.

How to do this in the PHP code (without using a plugin)?

Said differently, how to have permalinks /%category%/%postname%/ for all categories except one category which should have /%postname%/ permalinks?

In the answer of Permalinks - Different structures for different categories? (I cannot comment there because I don't have enough reputation), it is said to create a new taxonomy. But how to set different permalinks for a new taxonomy?

1 Answer 1

0

There is an option for adding custom structure you can select the checkbox and Permalink is generated like this example.com/article2. and there is also a product permalink that is also customizable.

Edit

There is an option for setting permalink in WordPress setting you can select "post name" check box for getting only post name in URL and create custom permalink.Screenshot

and also visit this page for more information https://wordpress.org/support/article/settings-permalinks-screen/

2
  • Thank you. Can you please add more details? Which checkbox (maybe you can add a screenshot)? Which "custom structure"? Which "product permalink"? Thank you in advance.
    – jontwo
    Oct 21, 2021 at 11:29
  • 1
    Sorry, but this does not answer the question. %category%/%post_name% should be kept for all articles of all categories except one category, for which articles should have permalinks %post_name%.
    – jontwo
    Oct 21, 2021 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.