Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@BinaryMoon
Last active October 27, 2020 14:41
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 BinaryMoon/9ce9c513932f55978e1920758b924c5e to your computer and use it in GitHub Desktop.
Save BinaryMoon/9ce9c513932f55978e1920758b924c5e to your computer and use it in GitHub Desktop.
Only execute the_content on the_content and not the_excerpt
<?php
function example( $content ) {
/**
* Only add social sharing links to the_content and not content passed through get_the_excerpt.
*/
global $wp_current_filter;
if ( in_array( 'get_the_excerpt', $wp_current_filter, true ) ) {
return $content;
}
}
add_filter( 'the_content', 'example' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment