How to load file only in single post page through function.php?
is_single function checks for $wp_query global variable is loading single post of any post type or not , $wp_query is set after running query_posts function that loaded after wp action hook. So you should call this function in the right order ( hook ) add_action( ‘wp’, ‘include_single_lazy_load’ ); function include_single_lazy_load() { if( is_single() ) { … Read more