Remove Prefix from Custom Post Type Slug
There is a simpler and lighter solution: First: set the slug argument for your custom post type to “https://wordpress.stackexchange.com/” when registering the post type: add_action( ‘init’, ‘register_my_post_type’ ); function register_my_post_type() { $args = array( //The rest of arguments you are currently using goes here ‘rewrite’ => array( ‘slug’ => “https://wordpress.stackexchange.com/” ) ); register_post_type( ‘my-post-type’, $args … Read more