WordPress.org

Ready to get started?Download WordPress

Forums

disable wpautop - tried plugins and remove_filter (2 posts)

  1. alimacca
    Member
    Posted 1 year ago #

    Hello,

    I cannot for the life of me disable the wpautop function in my theme. I have tried various plugins and also this:

    <?php
    /**
     * Roots functions
     */
    
    remove_filter( 'the_content', 'wpautop', 30 );
    remove_filter( 'the_excerpt', 'wpautop', 30 );
    remove_filter( 'comment_text', 'wpautop', 30 );
    
    if (!defined('__DIR__')) { define('__DIR__', dirname(__FILE__)); }
    
    require_once locate_template('/lib/utils.php');           // Utility functions
    require_once locate_template('/lib/config.php');          // Configuration...

    in my theme functions.php

    Is there something I am doing wrong. I have disabled it successfully on other themes, but I know roots and bootstrap is set up a little differently.

    The extra <p> tags are driving me insane, especially as I will be passing this to a client soon and they will be using the visual editor edit, thus screwing up the other handwritten code...

    Any help would be brilliant. As always time out to help is greatly appreciated.

    Best,

    Ali.

  2. vjpo
    Member
    Posted 1 year ago #

    It seems you don't need to add priority when removing this filter for the_content and the_excerpt. Example from the Codex also doesn't have it.

    It happen that visual editor also adding and saving <p> into a post content. Check if there is no extra p in a post content (text editor mode).

    As an option, try Disabler plugin.

Topic Closed

This topic has been closed to new replies.

About this Topic