Resolve a custom post type name vs. page permalink conflict (same slug)

I have a custom post type called “visningshus”, and also a Page with that slug. This is as it should (must) be.

Currently, “http://my-site.com/visningshus” lists all posts of that type. I want to show the page that has that permalink slug instead.

How can I make WordPress not make the post type name take precedence, but instead the permalink, and show the Page?

8

The easiest would be to just disable the archive page for this CPT:

register_post_type( 'visningshus',
    array(
        [...]
        'has_archive' => false,
        [...]
    )
);

Don’t forget to refresh you permalinks afterwards at “Settings > Permalinks”

Leave a Comment