Skip to content

Instantly share code, notes, and snippets.

@tonykwon
Last active December 20, 2015 23:49
Show Gist options
  • Save tonykwon/6215404 to your computer and use it in GitHub Desktop.
Save tonykwon/6215404 to your computer and use it in GitHub Desktop.
Disabling Jetpack sharing_display
add_action( 'plugins_loaded', 'jetpack_sharedaddy' );
function jetpack_sharedaddy() {
if ( class_exists( 'Jetpack' ) &&
method_exists( 'Jetpack', 'get_active_modules' ) &&
in_array( 'sharedaddy', Jetpack::get_active_modules() ) ) {
/*
* we need to control where sharedaddy modules show up
*/
remove_filter( 'the_content', 'sharing_display', 19 );
remove_filter( 'the_excerpt', 'sharing_display', 19 );
}
}
add_filter( 'sharing_show', 'sharing_show', 11, 2 );
function sharing_show( $show, $post ) {
global $wp_query;
// use WordPress conditionals then return either true or false
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment