Skip to content

Instantly share code, notes, and snippets.

@lorenzocaum
Created May 31, 2016 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lorenzocaum/90db6751e04f426607212546578de889 to your computer and use it in GitHub Desktop.
Save lorenzocaum/90db6751e04f426607212546578de889 to your computer and use it in GitHub Desktop.
How to remove related posts from Jetpack from events in Event Espresso

Add the sample code below to your child theme's functions.php file or in a site specific plugin.

<?php
//* Do NOT include the opening php tag

//* Remove Jetpack related posts on single event pages
function ee_jetpackme_no_related_posts( $options ) {
if ( 'espresso_events' == get_post_type() && is_singular() && !post_password_required() ) {
        $options['enabled'] = false;
    }
    return $options;
}
add_filter( 'jetpack_relatedposts_filter_options', 'ee_jetpackme_no_related_posts' );
@lorenzocaum
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment