So, if I’m reading your code correctly, you are trying to dump all the current posts’ tag IDs into your tag__in array.
My only hesitation is I’m not sure exactly how the query returns the order, if it’s just done by post date or actual tag relevance.
That should look something like this:
if ( $tags ) {
$tag__in_array = wp_list_pluck( $tags, 'ID' );
$args = array(
'tag__in' => $tag__in_array,
'post__not_in' => array( $post->ID ),
'posts_per_page' => 30,
'ignore_sticky_posts' => true
);
$tags_query = new WP_Query( $args );
if( $tags_query->have_posts() ) {
// Rest is the same
Also, you’ll want to use ignore_sticky_posts
instead of caller_get_posts
caller_get_posts is deprecated since version 3.1!
Let me know if this works or not. Good luck!