is_single
most likely only works inside of The Loop, and functions.php
loads before you’re in The Loop.
You could try something like this:
add_action( 'wp_head', function(){
var_dump(is_single());
});
And now you see that is_single()
returns true
.
EDIT: I was probably off for suggesting it only works inside The Loop, but there’s definitely better places for is_single
than in functions.php
, and if you’re checking the “singleness” of a page, wait until you’re in the request proper, or the template, to use it.