Related Posts: Enable filter no longer functional
Steps to reproduce the issue
I added this custom code long ago to hide related posts in WooCommerce products. It was taken from here: https://jetpack.com/support/related-posts/customize-related-posts/
function exclude_jetpack_related_from_products( $options ) {
if ( is_product() ) {
$options['enabled'] = false;
}
return $options;
}
add_filter( 'jetpack_relatedposts_filter_options', 'exclude_jetpack_related_from_products' );
It was working perfectly until the few latest updates of Jetpack.
What I expected
Not to see related posts in WooCommerce product pages.
What happened instead
I see related posts in WooCommerce product pages.
This was caused by #11220
Other reports in https://wordpress.org/support/topic/jetpack-related-posts-filter-for-turning-off-related-posts-broken-i-wp-5-x/
We'll discuss fixing this up in #11560. Thank you for reporting the issue!
1866967-zen
1883841-zen
1893096-zen
Possibly another case in https://wordpress.org/support/topic/cant-restrict-related-posts-to-only-48-hours, though I'm not sure as that case uses the jetpack_relatedposts_filter_date_range filter rather than jetpack_relatedposts_filter_options. But the behaviour appears to be the same - the filter is not having any effect even though it's correct from what I can see.
Two users are reporting this is still a problem after Jetpack 7.2: https://wordpress.org/support/topic/jetpack-related-posts-filter-for-turning-off-related-posts-broken-i-wp-5-x/#post-11388282
Any ideas?
Two users are reporting this is still a problem after Jetpack 7.2: https://wordpress.org/support/topic/jetpack-related-posts-filter-for-turning-off-related-posts-broken-i-wp-5-x/#post-11388282
Any ideas?
v7.2 doesn't appear on my updates page, so I can't test this yet.
Two users are reporting this is still a problem after Jetpack 7.2: https://wordpress.org/support/topic/jetpack-related-posts-filter-for-turning-off-related-posts-broken-i-wp-5-x/#post-11388282
Any ideas?
These users reported that the filter correctly removed the related posts items, but the related posts headline was still displayed. I was able to reproduce the headline issue with version 7.2, and it appears to be fixed by PR #12020 in version 7.3. So, this issue can be closed.
One user reported a problem with duplicate jp-relatedposts div elements. I haven’t been able to reproduce that problem, and I think it's unrelated to this issue.