I’m trying to let users select the page(s) on which a custom post type will appear by using a Page Link custom field that allows for multiple selections.
I’m getting post IDs like this:
$alert_pages = get_field('alert_pages', false, false);
Then imploding the array:
$alert_page_array = "'".implode("','",$alert_pages)."'";
Echoing $alert_page_array returns ’34’,’63’,’91’
Using the following works:
if( is_page( array ( '34','63','91' ) ) ) {
But using the variable in there instead does not work:
if( is_page( array( $alert_page_array ) ) ) {
Can anyone see where I’m going wrong or if there’s a better way to use ACF for this purpose?
Thanks.