Syntax

is_singular>( string|array $post_types = ‘ ‘)

Usage

It determines whether the query is for an existing post under any page type (Blog post, attachment, page, custom post types). It enables you to target single-view pages, regular page pages, and the attachment page all in one swoop.
Add this below code to wp-includes/query.php

function is_singular( $post_types = '' ) {
    global $wp_query;
    if ( ! isset( $wp_query ) ) {
        _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
        return false;
    }
    return $wp_query->is_singular( $post_types );
}