• I’m trying to exclude posts with specific tags from showing up in the Related Posts recommendations.

    I’m able to use the code to exclude the “giveaways” tag but I’m also trying to exclude the “housekeeping” tag… and it doesn’t seem to work.

    I tried the method in this post https://wordpress.org/support/topic/jetpack-related-posts-how-to-exclude-multiple-categories (substituting tag instead of category as appropriate), but no luck.

    What’s odd is that it will exclude the giveaways category correctly, regardless of order listed in the arrow (giveaways first, then housekeeping, or vice-versa).. I tried changing the name (and slug) of the housekeeping tag, but that didn’t work either. Also tried using “tag.name.raw” instead of “tag.slug” but, no.

    Any ideas? Thanks!

    // EXCLUDE GIVEAWAY POSTS FROM JETPACK RELATED POSTS
    function jetpackme_filter_exclude_tag( $filters ) {
        $filters[] = array( 'not' =>
          array( 'terms' => array( 'tag.slug' => array('housekeeping','giveaways') ) )
        );
        return $filters;
    }
    add_filter( 'jetpack_relatedposts_filter_filters', 'jetpackme_filter_exclude_tag' );

    https://wordpress.org/plugins/jetpack/

Viewing 1 replies (of 1 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    That code appears to be correct.

    However, we cache results for related posts for 12 hours so your site does not have to contact WordPress.com on every page load; it could very well be why these tags haven’t been excluded yet.

    If the posts still appear 12 hours after you’ve made those changes, could you post a link to one of the posts where you experience the issue, so I can take a closer look?

    If you want your site URL to remain private, you can also contact us via this contact form:
    http://jetpack.me/contact-support/

    Thanks!

Viewing 1 replies (of 1 total)
  • The topic ‘Unable to exclude multiple tags from Jetpack Related Posts results’ is closed to new replies.