Does anybody know why this works:
if ( is_page( array( 'home', 'contact' ) ) ) {}
But this doesn’t:
$pages = array( 'home', 'contact' );
if ( is_page( $pages ) ) {}
Even when adding settype( $pages, 'array');
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityDoes anybody know why this works:
if ( is_page( array( 'home', 'contact' ) ) ) {}
But this doesn’t:
$pages = array( 'home', 'contact' );
if ( is_page( $pages ) ) {}
Even when adding settype( $pages, 'array');
var_dump()
look like for$pages
? – Tony Djukic Nov 27 '20 at 16:05