Getting rid of /my_custom_post_type/ in the single view URL

When I’m reading a custom type post in the single view, I see that the URL is www.my_site.com/my_custom_post_type/title_of_my_post.

How to get rid of this ugly /my_custom_post_type/ ?

Related posts

Leave a Reply

1 comment

  1. register_post_type( 'my_custom_post_type', array(
        'rewrite' => array( 'with_front' => false ),
        // other args
    ));
    

    Make sure you flush your permalinks after changing your code – simply going to Settings > Permalinks is sufficient.