I'm using the following wp_query snippet to show all pages on a single page while being able to select individual pages to exclude.
// This pulls a list of page ID's from a theme options multicheck field $pages = of_get_option('exclude_pages' ); // This shows only those ID's that have been checked $implode_pages = implode(', ',array_keys($pages, 1)); $args = array( 'post_type' => 'page', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'asc', 'post__not_in' => array($implode_pages) ); $page_query = new WP_Query($args); while ($page_query->have_posts()) : $page_query->the_post();
If I simply echo the
$implode_pages bit in a page it displays like this
12, 31 where 12 and 31 are page ID's
But when I try and include it in the
post__not_in argument as shown above it only excludes the first ID even though if I hard code
12, 31 in there it excludes both...
Am I doing something wrong?