1

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');

  • That is weird. What's the var_dump() look like for $pages? – Tony Djukic Nov 27 '20 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.