Skip to content

Instantly share code, notes, and snippets.

@neverything neverything/functions.php
Last active Apr 11, 2019

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
You can’t perform that action at this time.