functions.php conditional tag only for custom post type

Try using get_post_type() instead:

if ( is_single() && 'post_type' == get_post_type() ) {
    // Do something
}

The is_post_type() conditional is deprecated. But even when it existed, it returned true if the current post is any registered custom post type. It has been replaced with post_type_exists().

(More information on Post Type conditional tags.)

Leave a Comment