• I have a post category with the slug “success”

    I also have this code in my functions.php

    Even though I used the filter in line with jetpack customization guidelines posts in the category “success” still appear in the related posts section.

    I thought it may be a caching or indexing issue but it has been a week with no change and I have re-indexed / cleared cache.

    /*filter out success stories from related posts*/
    function jetpackme_filter_exclude_category( $filters ) {
        $filters[] = array( 'not' =>
          array( 'term' => array( 'category.slug' => 'success' ) )
        );
        return $filters;
    }
    add_filter( 'jetpack_relatedposts_filter_filters', 'jetpackme_filter_exclude_category' );
    
    • This topic was modified 8 years, 1 month ago by jbotte.
Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Could you post a few examples of the posts where “Success” posts appear, but shouldn’t, 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:
    https://jetpack.com/contact-support/

    Thanks!

    Same issue all of a sudden on my site also. The exclude filter used to work, now it’s not.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    @carroc Could you follow the instructions I posted above to give us more details about the issue on your site?

    Thanks!

    Heather Acton

    (@heatheracton)

    Hi Jeremy,

    Same thing here.

    My code is:

    function jetpackme_filter_exclude_category( $filters ) {
        $filters[] = array( 'not' => array( 'term' => array( 'category.slug' => 'lawyer-spotlight' ) ) );
        return $filters;
    }
    add_filter( 'jetpack_relatedposts_filter_filters', 'jetpackme_filter_exclude_category' );

    If you see this post:
    https://www.2civility.org/pro-bono-service-and-lifes-larger-purpose/

    You’ll see the Mary Curry post in the Related section which is in the Lawyer Spotlight category that should be excluded.

    Any help is appreciated – thank you!
    Heather

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    @heatheracton Could you try the following code instead? It includes a tiny change that may fix things:

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

    Once you’ve made that change, you’ll need to relaunch a full synchronization of your posts with WordPress.com. You can do so thanks to the ‘Full Sync’ button appearing at the bottom of this page, after picking your site from the site picker.

    Let me know how it goes.

    Heather Acton

    (@heatheracton)

    Thank you, Jeremy – I tried that version of the snippet and did the full sync, but still no go. I am on WP Engine with object cache enabled (though I cleared it) so it may take a bit to see it, but I was assuming this query was done on the Jetpack side and not actually on the site? Maybe I’m mistaken there..probably am. Either way, I still see a post from Lawyer Spotlight on https://www.2civility.org/pro-bono-service-and-lifes-larger-purpose/

    Open to other thoughts on this for sure. Thank you!

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Sorry to hear that didn’t work. I’ve asked our Related Posts expert to take a look and I’ll get back to you as soon as I have some news!

    Heather Acton

    (@heatheracton)

    Thanks again, @jeremy!

    Any updates on this? It’s been 2 months and I’m still having this issue.

    Does anyone have a remedy?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    @oakley56fila In most cases the problems appear to be caused by synchronization issues between the Jetpack site and WordPress.con; some of data (like categories) isn’t transferred over to WordPress.com and isn’t indexed, thus making it impossible to exclude by category later on. Unfortunately, we haven’t found what’s blocking the synchronization yet. We’re still looking into this.

    If you’d like to give me a few examples of the posts you’re trying to exclude on your site, I’ll be happy to take a look as well; the additional example may help us find what’s causing this!

    Thanks!

    I’m also hoping to find a fix for this – the jetpack related posts have been so much better than others I’ve tried!

    I’m running a news site. I created a category called “Event” which I assign to posts no one would want to read after the event has passed. I used the most recent code snippet and replaced ‘lawyer-spotlight’ with ‘event’ but no luck.

    So any of these posts shouldn’t show up.

    Here’s a recent post in which several “Event” categories are linked.

    Also at the bottom of this post I see this post as related.

    Then on this one there are two posts marked as “Event” showing up under related.

    I’ll paste in the function code here just to rule that out:

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

    (@jeherve)

    Jetpack Mechanic ??

    @dendis84 Could you go to this page, choose your site, and then click on the “Full Sync” button appearing at the bottom of the page?

    Let me know if it solves the issue once the Related Posts cache is refreshed (it can take up to 12 hours).

    Thanks!

    Thanks @jeherve- I wanted to do another round of posts to make sure, but it looks like I’m still not having any luck excluding the event posts. Let me know if there’s anything else I can try, I’m game.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    @dendis84 Thanks for giving it a try. We’ll run some more tests to try to understand what’s stopping the synchronization here. I’ll get back to you as soon as I have some news.

    4 months and still not working on my site nor has anyone replied to my open ticket #2897350 about it with Jetpack.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘related post category filter not working’ is closed to new replies.