term_id; $args=array( 'post__not_in' => array(get_the_ID()), 'posts_per_page'=> 3, 'tax_query' => array( 'relation' => 'OR', array( 'taxonomy' => 'category', 'field' => 'term_id', 'terms' => wp_get_post_categories(get_the_ID()), ), array( 'taxonomy' => 'post_tag', 'field' => 'term_id', 'terms' => $tag_ids, ), ), ); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { ?>