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

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