Force unique page slugs across all post types
A unique slug for posts is done by wp_unique_post_slug(). Looking at the source the returned slug is filtered by wp_unique_post_slug. So we can replace this generated slug with our own. You’ll notice in the source that attachments are required to have unique slugs across all types, so we’ll just use the code from that. The … Read more