So, you’ve created a shiny new Custom Post Type with some code and you need to rewrite your CPT to remove the slug, eh… ?
Perhaps it generates URLs something like this :
– but what you really need is :
Luckily, it’s super-simple to correct.
When registering your CPT (Custom Post Type), add the following to the arguments array :
'rewrite' => array( 'slug' => '/', 'with_front' => false )
Simple as that. You’re done.
Looking for the full lowdown on creating Custom Post Types in WordPress… ?
You’ll want to check out the documentation here :
There’s also a super-handy automated snippet generator tool over at GenerateWP.