I have a custom loop for showing child pages of the current page, but I'd like to allow the WP user to enter page IDs to be excluded from the loop, using Advanced Custom Fields. My current loop is as follows. It almost works, except it only excludes the first page ID in the list:
<?php $exclude_ids = get_field('exclude_pages'); $args = array ( 'post_type' => 'page', // custom post type 'post_parent' => $post->ID, 'orderby' => 'menu_order title', 'order' => 'ASC', 'posts_per_page' => -1, 'post__not_in' => array( $exclude_ids ) );?>
And the Advanced Custom Field is set as a text field, with no formatting. In that parent page, I have entered the page IDs in the ACF field as
2147,2145 (no quotes, no parenthesis).
Interestingly, when I echo the variable, it shows the page IDs correctly, but it's just not working when it's part of the array...?
What am I doing wrong? Thank you!!! C