Last active
October 27, 2020 14:41
-
-
Save BinaryMoon/9ce9c513932f55978e1920758b924c5e to your computer and use it in GitHub Desktop.
Only execute the_content on the_content and not the_excerpt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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