3, 'orderby' => 'rand', 'post__not_in' => array( get_the_ID() ), ); $bookstore_exhibition_tax_terms = wp_get_post_terms( get_the_ID(), 'category' ); $bookstore_exhibition_terms_ids = array(); foreach( $bookstore_exhibition_tax_terms as $tax_term ) { $bookstore_exhibition_terms_ids[] = $tax_term->term_id; } $bookstore_exhibition_post_args['category__in'] = $bookstore_exhibition_terms_ids; $bookstore_exhibition_related_posts = new WP_Query( $bookstore_exhibition_post_args ); if ( $bookstore_exhibition_related_posts->have_posts() ) : ?>

have_posts() ) : $bookstore_exhibition_related_posts->the_post(); ?>