The get_theme_mod()
function could return an explicit false
. The ===
operator looks for exact matches, so in the case of hide_logo
not being set the function would return false
and false is not an exact match to an empty string ''
. The ==
operator is a bit more forgiving in that sense which is why you don’t have an issue there.
You could supply a default value as the second parameter which will be returned if a value is not set or does not exist:
if( '' === get_theme_mod( 'hide_logo', '' ) ) {}