WP_Query post__in from Custom Field
-
I am using a custom meta field (from RWMB Meta Plugin) to get a comma separated list of page IDs from a custom post type in order to use a custom loop and echo out these page values (title, excerpt etc).
But for some reason my code WILL NOT work. I can get the result of the first ID, but not the entire ID list.
Here is what I have
if ( rwmb_meta('farrlaw_practice_attorneys', true ) ) { $attorney_ids = rwmb_meta( 'farrlaw_practice_attorneys' ); $attorney_ids_array = array( $attorney_ids ); } $args = array( 'post_type' => 'attorneys', 'post__in' => $attorney_ids_array, 'posts_per_page' => -1, 'nopaging' => true ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); the_title(); endwhile; wp_reset_query();
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘WP_Query post__in from Custom Field’ is closed to new replies.