Created
December 3, 2012 19:56
-
-
Save enigmaticape/4197551 to your computer and use it in GitHub Desktop.
Wordpress does bad things with shortcodes and p tags
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 eschtml_func( $atts, $content = null ) { | |
return htmlentities( $content ); | |
} | |
add_shortcode( 'eschtml', 'eschtml_func' ); | |
?> |
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 eschtml_func( $atts, $content = null ) { | |
return htmlentities( $content ); | |
} | |
remove_filter( 'the_content', 'wpautop' ); | |
add_filter( 'the_content', 'wpautop' , 12); | |
add_shortcode( 'eschtml', 'eschtml_func' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From a post about the various ways you can stop wordpress wpautop clobbering the content in your enclosing shortcodes and doing surprising things with P tags at Enigmatic Ape Blog : http://www.enigmaticape.com/blog/wordpress-shortcode-p-tags-an-html-escape-plugin/