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

have_posts() ) : $books_printing_related_posts->the_post(); ?>
>
<?php esc_attr_e( 'Post Image', 'books-printing' ); ?>