I have a custom post type whose permalink needs to sit in the same space as pages, like so:
/an-example-thing <-- custom post type 'thing'
/about-the-things <-- a normal page
I’m well aware that this isn’t the recommended way to do it, but I don’t really have a choice – that’s what the client has specified.
I’ve created the custom types with register_post_type, and used the Custom Post Permalinks plugin to set their permalink like so:
/%thing%/
However, this creates a conflict between the rule that recognises my custom posts, and the one for normal pages – which turns all normal pages into 404s. This problem disappears when the permalink is changed to something like this:
/things/%thing%/
Using the Monkeyman Rewrite Analyser shows that the rule for the custom post is coming first. Even when I try forcing it to use verbose rules:
global $wp_rewrite;
$wp_rewrite->use_verbose_page_rules = true;
the custom post type rule is higher priority than the verbose rules for pages so they still get a 404.
I’d like it to look for things first, and when none is found with that name look for pages. The other way round would be acceptable. Is there no way of persuading it to look for both things and pages before hitting a 404?