AnswerBun.com

Weird issue with is_pages() with array

WordPress Development Asked by birdseyedesign on December 11, 2020

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

Add your own answers!

Related Questions

Add Featured Image and Title to wp_nav_menu items

1  Asked on November 19, 2020 by red5

   

Google Analytics – add script to functions.php

0  Asked on November 19, 2020 by szachmat

   

Modify Maximum upload file size text in WordPress Media

0  Asked on November 15, 2020 by tacker

   

How to display fields from the loop in two separate divs

1  Asked on November 3, 2020 by pual

   

Correct permalinks and 404-error

1  Asked on November 1, 2020 by vlad

   

Add custom field to Posts and sort by it

1  Asked on October 27, 2020 by nikname

     

How to generate the COOKIEHASH from JavaScript

1  Asked on October 26, 2020 by zeth

   

Custom permalink variable on single post

1  Asked on October 20, 2020 by quyet

   

get_terms (or tax_query) for term of current post?

2  Asked on October 18, 2020 by fntc

     

How to customize the Lost Password URL?

0  Asked on October 17, 2020 by radu

   

How to add one time a new page?

1  Asked on October 17, 2020 by zed93

 

Woocommerce tables not responsive mobile

1  Asked on October 8, 2020 by rickmorty

     

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP