Support reply may delay for 3 weeks due to corona virus outbreak, please send us email to support@pickplugins.com
0
msbt
Oct 29, 2020 03:47 PM 1 Answers
Member Since Oct 2020
Subscribed Subscribe Not subscribe
Flag(0)

Hi there!

As already mentioned <a href="https://wordpress.org/support/topic/current-post-is-not-excluded/" target="_blank" rel="noopener">here</a> I\'m having issues with the related posts plugin. I\'m using Content Views Pro to display posts and the related posts plugin in the sidebar via shortcode. I would expect the current post not to show in that list, but it\'s there. I also tried adding this to my functions.php:
<pre>add_action(\'related_post_main\', \'remove_related_posts\', 2);
function remove_related_posts(){
if(is_singular(array(\'post\'))){
<strong>$excluded_posts = get_the_ID();</strong>
$post_id = get_the_ID();
if(in_array($post_id, $excluded_posts)){
remove_action(\'related_post_main\' ,\'related_post_main_title\');
remove_action(\'related_post_main\' ,\'related_post_main_post_loop\');
}
}
}</pre>
which should remove the current post, right? Am I missing something else?

Best regards,
Matthias

0 Subscribers
Submit Answer
Please login to submit answer.
1 Answers
Sort By:
Best Answer
0
PickPlugins
Oct 30, 2020
Flag(0)

Welcome to our forum.

have you checked my reply on wp.org?

https://wordpress.org/support/topic/current-post-is-not-excluded/

Regards

Sign in to Reply
Replying as Submit