bobbingwide / dupes

Cater for duplicate slugs in WordPress content
GNU General Public License v2.0
0 stars 0 forks source link

Scenarios for page name matching CPT rewrite slug #5

Open bobbingwide opened 2 years ago

bobbingwide commented 2 years ago

It would appear that regardless of the permalink structure, if you create a page with the same name as the rewrite slug for a custom post type which has_archive, then the custom post type's archive is displayed instead of the unique post.

eg for CPT hierarchical viewing the permalink for the page name hierarchical. Post ID 3588. Post type page gives the Archive template for the URL https://s.b/cwiccer/hierarchical/.

This was with permalink structure: /%postname%/%post_id%/

For a duplicate post we get a 404. eg Post 3592 permalink https://s.b/cwiccer/hierarchical/3592/

bobbingwide commented 2 years ago
Permalink structure CPT CPT name Duplicate type Duplicate post name Permalink Content retrieved
/%postname%/%post_id%/ hierarchical h1 page hierarchical s.b/cwiccer/hierarrchical/ Archive for CPT
/%postname%/%post_id%/ hierarchical h1 page hierarchical/h1 s.b/cwiccer/hierarrchical/h1/ Archive for CPT
/%postname%/%post_id%/ hierarchical h1 post hierarchical s.b/cwiccer/hierarchical/3592/ 404
/%postname%/ hierarchical hierarchical page hierarchical s.b/cwiccer/hierarchical/ Archive for CPT
/%postname%/ hierarchical h1 page hierarchical/h1 s.b/cwiccer/hierarchical/h1/ hierarchical post
/%postname%/ hierarchical hierarchical post hierarchical s.b/cwiccer/hierarchical Archive for CPT
bobbingwide commented 2 years ago

Things get a bit wierder when the hierarchical CPT is configured as Exclude from search and you perform a search. None of the hierarchical posts are listed but clicking on any of the posts that are returned with the hierarchical slug takes you to the Archive.