• Resolved John Antonacci

    (@johnnya23)


    I’m building a couple of custom content blocks for WordPress ver 5+. WordPress is wrapping (or worse yet prepending) html <!—comments—> with p tags.

    remove_filter( ‘the_content’, ‘wpautop’ );

    seems to have no effect. How do I avoid this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Those comments are what makes them “blocks”. And wpautop is already removed for content in the new editor.

    Thread Starter John Antonacci

    (@johnnya23)

    Thanks for the response @joyously.

    I guess I see that now that I turn Classic Editor plugin on and off. I guess this means on html comments in blocks…

    Do you mean that you can’t have any other HTML comments inside your blocks?
    I’ve not messed with the new editor much, but you should try it and see if it’s a problem. You should not be limited. But then, I’ve heard that if you switch to text mode and change things, it can break the blocks (or strip out what you added) or just show it as a “Classic Block”.
    And, if you have a mixture of legacy content and new posts with blocks, and you remain on pre-5.0, the blocks will have too many <p> added by wpautop. So if you are going to have any posts with blocks, it’s best to be on 5.0+ so that they are handled consistently. (But that doesn’t mean you have to use blocks, as the Classic Editor plugin is there.)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Content Blocks and p tags’ is closed to new replies.