How to have a custom URL structure for a custom post type?

When you registered the post type, one of the arguments was rewrite, which took an array. make sure there’s a with_front argument in the rewrite array, and set it to false.

<?php
$args = array(
    // other stuf...
    'rewrite' => array( 
         'slug' => 'popups',
         'with_front' => false
     ),
     // other stuf...
);

register_post_type( 'type', $args );

That should take care of it.

Important: Be sure to flush your rewrite rules after changing the code (go to settings > permalinks and hit save).

Leave a Comment