Skip to content

Instantly share code, notes, and snippets.

@neverything
Last active April 11, 2019 15:58
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Remove Jetpack Related Posts from Woo Testimonials
<?php
/**
* Remove Jetpack Related Posts from Woo Testimonials shortcode
*
* @see http://jetpack.me/support/related-posts/customize-related-posts/#delete
*
* @param string $content
* @return string $content
*/
function sha_jetpackme_remove_rp( $content ) {
// Get the Jetpack Related Posts instance
$jprp = Jetpack_RelatedPosts::init();
$callback = array( $jprp, 'filter_add_target_to_dom' );
// Only remove it from the woo_testimonials the_content filter
if ( 'testimonial' === get_post_type() ) {
remove_filter( 'the_content', $callback, 40 );
}
return $content;
}
add_filter( 'the_content', 'sha_jetpackme_remove_rp', 20 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment