LeoLopesWeb
10/23/2019 - 2:01 PM

Related Posts for Custom Post Type

$customTaxonomyTerms = wp_get_object_terms( $post->ID, 'CUSTOM_TAXONOMY', array('fields' => 'ids') );     
			$args = array(
					'post_type'      => 'POST_TYPE',
					'posts_per_page' => 3,
					'order'          => 'DESC',
          'orderby'        => 'meta_value',
          'tax_query' => array(
            array(
                'taxonomy' => 'CUSTOM_TAXONOMY',
                'field' => 'id',
                'terms' => $customTaxonomyTerms
                )
              ),
              'post__not_in' => array ($post->ID),
      );