Created
February 10, 2015 22:02
-
-
Save myasseen/99cfa02666b03fda3520 to your computer and use it in GitHub Desktop.
Disable WordPress "wpautop" on specific posts/pages!
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 | |
/* | |
* Plugin Name: Disable wpautop | |
* Plugin URI: http://masterscene.com | |
* Author: Mahmoud Yasseen | |
* Author URI: http://masterscene.com | |
* Version: 1.1 | |
* Description: Disable wpautop on posts/pages with custom field 'wpautop' == false. | |
*/ | |
function custom_wpautop($content) { | |
if (get_post_meta(get_the_ID(), 'wpautop', true) == 'false') | |
return $content; | |
else | |
return wpautop($content); | |
} | |
remove_filter('the_content', 'wpautop'); | |
add_filter('the_content', 'custom_wpautop'); | |
?> | |
---------------------------------------------- | |
and add a custom field: | |
Name: wpautop | |
Value: false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment