WordPress Custom Post Type is Matching on Partial Slug

Add this code in your active theme’s functions.php file and it should stop WordPress guessing the source of the incomplete slug:

function no_redirect_guess_404_permalink( $header ){
    global $wp_query;

    if( is_404() )
        unset( $wp_query->query_vars['name'] );

    return $header;
}

add_filter( 'status_header', 'no_redirect_guess_404_permalink' );

Original answer here

Leave a Comment