Created
July 5, 2014 10:23
-
-
Save davidjgoss/975d6036262c2d00bdc9 to your computer and use it in GitHub Desktop.
Stop WordPress filters from touching page HTML
This file contains 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 remove_filter( "the_content", "wpautop" ); | |
remove_filter( "the_content", "wptexturize" ); ?> | |
<?php while ( have_posts() ) : the_post(); ?> | |
<?php the_content(); ?> | |
<?php endwhile; ?> | |
<?php add_filter( "the_content", "wpautop" ); | |
add_filter( "the_content", "wptexturize" ); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
WordPress' built-in filters will automatically insert
<p>
tags and convert quotes, amongst other things, on a page's content. This plays well with what the rich text editor does, but if you write your page's content in HTML and want it to be output exactly as you wrote it, it's a problem.Use this in the custom template for your page where you want the content to appear. It just turns off the filters whilst your content is output, then turns them back on again.