• In WordPress 5.x, when I register post type with ‘show_in_rest’ => true,
    then add a custom meta box with wp_editor().
    the setting ‘wpautop’=> ‘false’ not working well.

    For example, When I add a new gallery and some text to this editor field, then switch to code editor mode. all of the text or gallery shortcodes will be wrapped by p tags.

    How can I resolve it?

Viewing 1 replies (of 1 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    You don’t.

    WordPress, using the new block editor, no longer runs the wpautop() function in PHP. So, wpautop is already “false” by default if the post contains blocks.

    Instead, the block editor itself will insert and save the P tags in the post_content. The HTML saved in the database will actually have the P tags now, and they won’t just be automatically added after the fact. This makes the post_content a much truer representation of what will be output on the front end of the page.

    Oh, and if you’re putting in shortcodes, use a shortcode block instead of typing them into a P block. Then you won’t have wrapper P tags.

Viewing 1 replies (of 1 total)
  • The topic ‘wpautop not working on wp_editor()’ is closed to new replies.