How to Set Both Category and Sub-Category Level at Root. It should also obey post rule as /category/sample-post and /sub-catgeory/sample-post?

You’ll need to define your own rewrite tag, and add the tag into the permalink structure. add_rewrite_tag() to register the new structure tag available_permalink_structure_tags filter to add to Permalinks interface post_link filter to change the URL of posts Below is untested and incomplete code, but should get you pretty far. add_action( ‘init’, static function () … Read more

Rewrite permalink with PHP processing

Based on your example there are 4 fundamental steps to take. I’ve tried to use examples below, and they may not work as is, but they demonstrate the fundamental principles needed: 1. Add a query var shorty This whitelists shorty and gives the 2c from /shorty/2c somewhere to be stored function shorty_query_vars( array $qvars ) … Read more