I have three posts, two which have the tag eGuide
one which has the tag Article
. When I click on an eGuide
, I want the sidebar to display other eGuide's (up to 2) and nothing else. To do this, I have the following query:
global $post;
$args = array(
'post_type' => 'resources',
'category__in' => wp_get_post_categories($post->ID ),
'posts_per_page' => 3,
'post__not_in' => array($post->ID )
);
$relatedPosts = new WP_Query( $args );
But it's showing the article
too? I've also tried:
'post__not_in' => array(get_the_ID() )
... still no luck.