I use this function Remove slug from custom post type post URLs to remove slug from custom post type URLs .. but now I have issues... page.php is not working ... so now my pages with default template use single.php instead page.php .. is there any solution to fix this? :(


I found solution on this link Remove Slug from Custom Post Type answer from user @cybmeta helps

add_action( 'parse_query', 'wpse_parse_query' );
function wpse_parse_query( $wp_query ) {

    if( get_page_by_path($wp_query->query_vars['name']) ) {
        $wp_query->is_single = false;
        $wp_query->is_page = true;


Only issues I can found now is to Prevent duplicate post slugs .. but this is another issues :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.