Support » Plugin: Jetpack - WP Security, Backup, Speed, & Growth » Exclude posts by category from related posts

  • Resolved timbobo

    (@timbobo)


    I have copied the code to exclude posts by category from my site from the related posts, but it does not seem to have any impact. I am wondering if there is a delay before the code takes effect. Right now it is included links to related posts that are in a private category and only available to logged in users. I am hoping to have these not show up as related posts at all.

    
    function jetpackme_filter_exclude_category( $filters ) {
        $filters[] = array(
            'not' => array(
                'terms' => array(
                    'category.slug' => array(
                        'private',
                    ),
                ),
            ),
        );
        return $filters;
    }
    add_filter( 'jetpack_relatedposts_filter_filters', 'jetpackme_filter_exclude_category' );
    

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support KokkieH

    (@kokkieh)

    Hi there,

    It can take a while, yes. Related posts are cached on our end for up to 12 hours. I’d give it at least a day for the posts to be re-indexed and the cache updated. You might also need to first publish a new post on the site to trigger the re-indexing.

    Thread Starter timbobo

    (@timbobo)

    Thank you for the response. I checked today and the posts categorized as private are still showing up as related posts. I tried opening the private post that is consistently showing up and updating it again. So far, no change. I will check again later this week.

    To provide more details. This page
    https://leftbrainmedia.com/leadership-challenge-preview/

    is very consistently showing this page as a related post.
    https://leftbrainmedia.com/leadership-challenges/

    Now unless you are logged in, you get bounced to the login screen when you try to view the related post. But I would rather these post not show up at all.

    Thanks in advance for any help anyone can provide.

    Plugin Support KokkieH

    (@kokkieh)

    I tried opening the private post that is consistently showing up and updating it again.

    Updating an existing post won’t trigger a re-indexing of the site, only publishing a completely new post. Can you please try that?

    If you’re using any plugins that modify the default behaviour of WordPress categories, can you also try disabling those first, before publishing a new post, and then give it 24 hours for Related Posts to re-index? Then comment here again if you still don’t see any change.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Exclude posts by category from related posts’ is closed to new replies.