Created
August 17, 2015 13:54
-
-
Save nickcernis/41ec69737e639c0ac3c9 to your computer and use it in GitHub Desktop.
Don't process a WordPress shortcode in wp_head
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 | |
global $wp_current_filter; | |
// Don't process this shortcode in wp_head. This typically happens if a plugin author | |
// uses apply_filters( 'the_content', $content ) for the meta description tag output, | |
// instead of using strip_shortcodes() like a sane person. Processing shortcodes in | |
// the head might be undesirable if your shortcode counts the number of times it's | |
// been used for the purpose of outputting unique class names or IDs, for example. | |
if ( in_array('wp_head', $wp_current_filter) ) { | |
return ''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment