Skip to content

Instantly share code, notes, and snippets.

@myasseen
Created February 10, 2015 22:02
Show Gist options
  • Save myasseen/99cfa02666b03fda3520 to your computer and use it in GitHub Desktop.
Save myasseen/99cfa02666b03fda3520 to your computer and use it in GitHub Desktop.
Disable WordPress "wpautop" on specific posts/pages!
<?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