Search code examples
wordpresswordpress-themingcustom-wordpress-pages

Custom URL's for custom post type


I am facing an issue regarding URL of the custom post type. I have created a custom post type called 'Methods'.

So I've added "The Lorem Method" and assign this as a parent to week 1 method. After that, I've added Day 1 and assign week 1 as a parent to this and list goes on. Now, at dashboard structure is looking like this

-The Lorem Method
-- Week 1
---- Day 1
---- Day 2
---- Day 3
---- Day 4
---- Day 5

-- Week 2
---- Day 1
---- Day 2
---- Day 3
---- Day 4
---- Day 5

-The Ipsum Method
-- Week 1
---- Day 1
---- Day 2
---- Day 3
---- Day 4
---- Day 5

-- Week 2
---- Day 1
---- Day 2
---- Day 3
---- Day 4
---- Day 5

I know slug of two post item could not be same, is there any way to get the permalink to be like this

the-lorem-method/week-1/day-2
the-ispum-method/week-1/day-2

the-lorem-method/week-2/day-3
the-ispum-method/week-2/day-3


Solution

  • The short answer is that there is not a way to do this, unfortunately. Once a slug is used, it's used - even across Post Types.

    You might have luck using something like the Custom Permalinks plugin, but it's not native WordPress functionality (and likely will never make it into WP Core)