Support » Fixing WordPress » remove_filter( 'the_content', 'wpautop' ); not working

  • Resolved iansane


    Hi, I know there are posts all over the place about the stupid p tags getting added by wordpress but I can’t find a solution anywhere other than the one in the codex to remove the filter but

    remove_filter( 'the_content', 'wpautop' );

    is not working.

    I don’t use the visual editor because it is mentally challenged. Actually I have it disabled.

    Adding yet another plugin is not a solution. It’s a hack. So if anyone knows why the remove filter method isn’t working could you please offer me some suggestions?

    I went into formatting.php and commented out the entire wpautop method except for the return, and everything is beautiful (don’t understand why it’s even part of wp) but that’s a temporary hack and won’t work with updates.


Viewing 2 replies - 1 through 2 (of 2 total)
  • I don’t use the visual editor because it is mentally challenged.


    Just a note: This page lists reasons why this will fail, for example, calling to remove a filter before it is called or if used with action hooks.

    Thanks SwansonPhotos,

    It turns out my theme (Vulcan theme) was removing it and then adding it back again through one of it’s functions.

     * Disable Automatic Formatting on Posts
     * Thanks to TheBinaryPenguin (
    function theme_formatter($content) {
    	$new_content = '';
    	$pattern_full = '{(\[raw\].*?\[/raw\])}is';
    	$pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
    	$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
    	foreach ($pieces as $piece) {
    		if (preg_match($pattern_contents, $piece, $matches)) {
    			$new_content .= $matches[1];
    		} else {
    			$new_content .= wptexturize(wpautop($piece));
    	return $new_content;
    remove_filter('the_content',	'wpautop');
    remove_filter('the_content',	'wptexturize');
    add_filter('the_content', 'theme_formatter', 99);
    add_action( 'init', 'my_add_excerpts_to_pages' );
    function my_add_excerpts_to_pages() {
         add_post_type_support( 'page', 'excerpt' );

    I don’t know what they are trying to do here but they actually kept me from being able to disable formatting functions.

    This fixed it at the bottom of my functions file
    remove_filter('the_content', 'theme_formatter', 99);

    Why won’t wp and themes just stay the heck outta my code? Don’t answer… rhetorical question.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘remove_filter( 'the_content', 'wpautop' ); not working’ is closed to new replies.