I use Tinymce Advanced plugin. I would like to remove p tag by adding this code remove_filter( 'the_content', 'wpautop' ); to my functions.php. However, it does't work. When I press ENTER, it still inserts double line, not single line. The p character still displays at the bottom left of the textarea.

  • Try adding a priority to that: remove_filter( 'the_content', 'wpautop', 3 ); Sep 17, 2017 at 18:18
  • I've added that but nothing changes. What's wrong with that?
    – Topy
    Sep 17, 2017 at 18:38
  • 3
    That function removes the behaviour from the front end, not the editor. You're going to have much less grief if you just accept that the WordPress editor is not an HTML editor and approach it accordingly. Sep 18, 2017 at 3:16
  • WordPress auto p drives me crazy. I don't have any problem to insert line break by pressing Shift + Enter as it is easy. But not all of my users know how to do as they get used to press Enter. How about in mobile, there is no shift. If I press enter in mobile, will it insert paragraph or line break?
    – Topy
    Sep 18, 2017 at 4:19
  • Possible duplicate of Remove_filter ('the_content', 'wpautop') is not working Apr 17, 2018 at 18:45

2 Answers 2


You can achieve this much easier with css (escpecially for wp-ers who dont have access to edit plugins):

  height: 0;
  margin: 0;
  padding: 0;

Your code seems pretty correnct. Please check whether your code actually removes wpautop function or not with this below line of code-

var_dump( $wp_filter['the_content'] );

Add it at the end of your functions.php and analyze the output. If the wpautop is still there then either it is getting added after your code is been executed or your code is not been executing at all.

If all the above is good but the code still doesn't work then I can suggest you this below forced removal of those p tag with below code-

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

This later block of code isn't tested. Please test it before going live.

Hope the above answer helps.

  • Hi, thanks for your instruction. I've tried all but not working.
    – Topy
    Sep 18, 2017 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.