Jetpack: Related posts shouldn't be in LearnDash courses

Created on 22 Oct 2020  路  6Comments  路  Source: Automattic/jetpack

Steps to reproduce the issue

  1. Install Jetpack and LearnDash plugins
  2. Create some courses, lessons and topics
  3. Go to some lesson and scroll down to the end of page
  4. You will see related posts block from Jetpack plugin with other lessons (even they are closed)

What I expected

Related posts should not be in LearnDash lessons and topics. Could you disable them for LearnDash courses?


  • Jetpack 9.0.2
  • LearnDash 3.2.3.5 (latest)
  • WordPress 5.5.1 (latets)
Related Posts

All 6 comments

Related posts should not be in LearnDash lessons and topics. Could you disable them for LearnDash courses?

Those Related Posts were enabled from within the LearnDash plugin. You can disable them using filters, like so:
https://jetpack.com/support/related-posts/customize-related-posts/#disable

@jeherve
Thanks for your response!

Maybe in future you will add more intuitive UI to selecting post types for related posts? Something with checkboxes and description.

Maybe in future you will add more intuitive UI to selecting post types for related posts? Something with checkboxes and description.

Yes, I agree it could be a nice improvement. That's something we're tracking here: #10067

@jeherve
I disabled related posts in WooCommerce products with using your example and function is_product(). But how can I identify LearnDash lesson page? Could you give some example?

I believe LearnDash uses the sfwd-lessons and sfwd-courses Custom Post Types. You could try targetting both like so: is_singular( array( 'sfwd-lessons', 'sfwd-courses' ) ).

@jeherve
Thanks!
Here is my code:

function jetpackme_exclude_jetpack_related_from_learndash( $options ) {
    if ( is_singular( array( 'sfwd-courses', 'sfwd-lessons', 'sfwd-quiz', 'sfwd-topic', 'sfwd-certificates' ) ) ) {
        $options['enabled'] = false;
    }
    return $options;
}
add_filter( 'jetpack_relatedposts_filter_options', 'jetpackme_exclude_jetpack_related_from_learndash' );

If you wish you can add it to docs page

Was this page helpful?
0 / 5 - 0 ratings