• Resolved eureka1

    (@eureka1)


    I have created a custom post and all works as expected. However, when I create a parent page (eg news page) that directs users into a news article, it does not write over CPT custom template. Eg. I want my permalink to be mydomain.com/news-story/news1. I set the permalink to news_story and the rewrite to news-story. However if I go to mydomain.com/news-story it re-directs me to what looks like a standard CPT template and not the page that I custom made with the permalink mydomain.com/news-story (but the permalinks look correct). If I take off the rewrite, the landing page mydomain.com/news-story looks correct, but the permalink is wrong when in a news article as it looks like: permalink to news_story

    Any ideas how to get this to work?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Initial question I have is if you have a page and a the post type named with the same slug. Both having “news-story” for example. It sounds like a page is being displayed instead of post type archive, or vice versa.

    Thread Starter eureka1

    (@eureka1)

    Hi I have tried it with and without the slug being the same without the desired results. Im making an assumption that the custom post type can have a page as its parent, is that right? i.e so when you look at the breadcrumbs or url trail it could say https://www.mydomain.com/parent-page/custom-post-article

    Thread Starter eureka1

    (@eureka1)

    I think i got to the bottom of it. Looks to have been the “has archive” switch that was doing causing it to over ride the parent page.

    • This reply was modified 7 years, 3 months ago by eureka1.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    From a WordPress UI standpoint, I’ve never seen cases of mixing post types like that with the “page” post type and a “movie” post type for an example. The WP UI doesn’t allow you select from other post types for the hierarchical detail.

    That said, the post_parent column in the database is simply an integer that specifies the post ID to designate as the parent. One could program/code things on their own to handle the crossing like that. I can’t say for certain at all how the UI will behave after that though.

    In most cases, the breadcrumb would end up looking like https://www.mydomain.com/post-type-slug/custom-post-article. However, going back to my original point regarding matching slugs, this runs risk of WP not being sure if “custom-post-article” is from the CPT, or a child page of the “page” post type, with the name of “custom-post-article”.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘url rewrite’ is closed to new replies.