Support » Plugin: Jetpack by WordPress.com » Related posts no longer working

  • Resolved danpowellbvm

    (@danpowellbvm)


    Hi, it looks like related posts has stopped working on my new site http://www.bvm.co.uk. They were working perfect a few weeks ago. Last week I changed the hosting company and domain name, now related posts are not being displayed.

    I have tried manually syncing my data from wordpress.com a few times but not had any luck fixing the issue.

    Can anyone help?

    Thanks

    Dan

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support darnelldibbles

    (@darnelldibbles)

    Hey there,

    There could be a few things that is causing the Related Posts to not show up.

    First, make sure that related posts are enabled in Jetpack → Settings → Traffic:

    Second, are you using any other Related Posts plugins? That may be interfering with the Jetpack related posts. If you are using other plugins, please disable them and see if that triggers the related posts to show back up.

    Hope that helps. Please let me know if you have any other questions or if those options do not work.

    Thanks,

    Hi, thanks for getting back to me. I have found the cause of the problem. I have been using a bit of code from jetpack.com to disable related Woocommerce products. The code has been working fine, now its stopping all related posts. When I disable the code related posts work.

    Is it possible to disable related posts just on products?

    thanks

    Dan

    function jetpackme_exclude_jetpack_related_from_products( $options ) {
        if ( is_product() ) {
            $options['enabled'] = false;
        }
     
        return $options;
    }
    add_filter( 'jetpack_relatedposts_filter_options', 'jetpackexclude_jetpack_related_from_products' );
    Plugin Support darnelldibbles

    (@darnelldibbles)

    This is the snippet used to hide WooCommerce related products:

    https://docs.woocommerce.com/document/remove-related-posts-output/

    Have you tried this code?

    Hi, thanks for the reply. I have tried the code snippet and css (using code snippets plugin) and its not working. Related posts still show on products.

    Do you have any other suggestions?

    many thanks

    Dan

    Plugin Author kbrownkd

    (@kbrownkd)

    Hi! I see a typo in your code snippet that would cause the problem you’re seeing. The function names don’t match. The function name is jetpackme_exclude_jetpack_related_from_products, but jetpackexclude_jetpack_related_from_products is used in add_filter().

    (I see that this code is from a Jetpack.com page, and I’ll correct the typo there.)

    This code should remove Related Posts from products:

    function jetpackme_exclude_jetpack_related_from_products( $options ) {
        if ( is_product() ) {
            $options['enabled'] = false;
        }
     
        return $options;
    }
    add_filter( 'jetpack_relatedposts_filter_options', 'jetpackme_exclude_jetpack_related_from_products' );

    Hi @kbrownkd, thanks for the reply,everything is now working as expected.

    many thanks

    Dan

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.