I've got a custom area during my posts therefore the admin can enter a listing of specific publish ids they need incorporated for that related content section within the sidebar. I'm attempting to place the variable into my wordpress_query_object but it's only querying the very first item.
After I echo the $related_videos variable it shows the ids I joined in to the custom area: 45,14,10.
Any assist with what I am doing wrong could be awesome. I seem like I am close but I have hit the wall.
<?php $related_vids = get_post_meta($post->ID, '_simple_fields_fieldGroupID_3_fieldID_2_numInSet_0', true); $the_query = new WP_Query( array( 'post__in' => array( $related_vids ) ) ); while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p> <?php endwhile; wp_reset_postdata(); ?>
array( $related_vids ) really produces an assortment that consists of 1 element:
["45,14,10"] and never an assortment that consists of 3 elements:
[45, 14, 10]
The thing you need is
explode( ', ', $related_vids )