New method to disable wpautop after WP 4.3?

After WordPress 4.3, the old method of disabling wpautop no longer works. Has anyone discovered a new method for removing this function?

remove_filter( 'the_content', 'wpautop', 99 );
remove_filter( 'the_excerpt', 'wpautop', 99 );

Topic wp-autop Wordpress

Category Web


This works well. It's about the priority of the hook :

add_filter( 'the_content', 'njengah_remove_autop', 0 );

function njengah_remove_autop($content) {

        // remove autop 

         remove_filter( 'the_content', 'wpautop' );


        return $content;
}

On the javascript side, as a crude measure you could just replace the wp.editor.autop and wp.editor.removep with no ops:

add_action( 'admin_print_footer_scripts', function () {
    ?>
    <script type="text/javascript">
    jQuery(function ($) {
        if (typeof wp === 'object' && typeof wp.editor === 'object') {
            wp.editor.autop = function (text) { return text; };
            wp.editor.removep = function (text) { return text; };
        }
    });
    </script>
    <?php
}, 100 );

However on very limited testing although it seems to keep markup it does put it all on one line in the Text editor, which is pretty ugly...


I guess you don't use it at all, so why don't you just remove the filter?

remove_filter('the_content', 'wpautop');
remove_filter('the_excerpt', 'wpautop');

I've tested it a few minutes ago (on WP 4.3) and it works.

p.s. I just saw that you use the same function. Sorry for that. What version are you using? This disables the wpautop on 4.3.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.