I’m showing child categories data in custom page using wordpress. Problem is that i’m fetching those child categories from parent category slug.
www.example.com/custom/?cp=category-slug
I want to remove ?cp=
and make it like thiss www.example.com/custom/category-slug
.
Is there any way to rewrite this specific custom page url, i will appreciate if someone help me regarding this.
There are many plugins who can make you achieve this goal, for instance https://wordpress.org/plugins/pretty-url/ or https://wordpress.org/plugins/wordpress-seo/
Instead of this, you can create a custom category template to list all of its sub-category data. Refer this https://codex.wordpress.org/Category_Templates Its url would be http://www.example.com/custom-post-type-slug/category-slug Also it won’t affect other category pages.
Step-1: Create a category template:
In your themes folder, create a .php file as save as category-slug.php
Step-2: Add a loop to list all its subcategory data
Just copy and paste the below code:
Change that loop according to your needs.