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

1
  • That is weird. What's the var_dump() look like for $pages? Commented Nov 27, 2020 at 16:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.