PAGES and CUSTOM TYPES cannot have the same name, so how to structure permalinks
-
As everybody knows you cannot have PAGES and CUSTOM TYPES with the same name, otherwise you can get a 404 (error) page with pagination and other kinds of problems.
While it makes sense that WP gets troubled from having to manage 2 URLs with the same name, how limiting is the fact that there is no solution to keep a logical permalinks consistency?
For example:
You want to have a SECTION of your website called “Agenda“, to hold events under that section, and therefore would like this permalinks structure:websitename.com/agenda (index of events)
websitename.com/agenda/event-name-1 (event 1)
websitename.com/agenda/event-name-2( event 2)
… and do on.You create a CUSTOM TYPE called “agenda”, so that the events index lives under that slug (websitename.com/agenda/event-name-1).
But you also need to create a PAGE with a slug of “agenda” with a page template with a loop for the “agenda” CUTOM TYPE, in order to get “websitename.com/agenda” which is the index of events.
But WordPress tells you, you can’t!
The community is aware of this limitation and the easy solution for everybody to deal with such a problem is to change either the PAGE name or the CUSTOM TYPE name, like advised everywhere:
– https://wpveda.com/solved-wordpress-custom-post-type-and-404-issue/
– https://www.wordimpressed.com/wordpress/solve-wordpress-custom-post-type-404-error-issues/
– https://modernsparkmedia.com/393/wordpress-pagination-with-custom-post-type/
– https://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress#comment-188256But changing the CUSTOM TYPE NAME to something like “events” is not a solution, is it? Because you end up having “websitename.com/events/event-name-1” when you wanted “websitename.com/agenda/event-name-1”.
So, I wonder, how come nobody seems to care about such a limitation? What if a CLIENT wants to have that kind of URL structure, with all the events under “Agenda”? How do you go and explain that he cannot, that WordPress is limited when it comes to wanted something like this?
Really, I can’t believe that in the whole WordPress community nobody is facing this problem and nobody has a solution, or put it out there.
- The topic ‘PAGES and CUSTOM TYPES cannot have the same name, so how to structure permalinks’ is closed to new replies.