Make WordPress Core

Opened 4 years ago

Last modified 14 months ago

#32548 new defect (bug)

Unecessary White Space Above Table

Reported by: ChuckC3 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Formatting Keywords: needs-patch
Focuses: Cc:


This may be a known problem but this is the first time I've discovered it. I have found that if I put a table on a page in this format:


WordPress will generate a number of unnecessary lines of white space prior to the table. If I remove the white space between the HTML elements so that it looks like this the problem of the unnecessary white space prior to the table goes away but the code looks like crp, of course:


Here's a link that led me to the solution to this problem::


The above post was from 2007 yet this problem still exists. Is everyone aware of this problem? Is there a solution?


Change History (4)

#1 @iseulde
4 years ago

  • Component changed from General to Editor
  • Keywords reporter-feedback added
  • Version 4.2.2 deleted

Thanks for the report.
I cannot reproduce the issue by pasting any of the two examples above. Could you please give us the exact steps to reproduce?

#2 @ChuckC3
4 years ago

Here are the exact steps I used to reproduce this problem:

  1. Create a new page
  2. In the new page, paste the following HTML:



  1. Preview the page
  2. Note the unnecessary white space above the table

I've attached two screen shots to show what this looks like on my system. If you are still unable to duplicate this problem, perhaps it is related to the theme I'm using which is 2012.



I couldn't figure out how to attach an image to this so I posted the images here:



#3 @swissspidy
2 years ago

  • Component changed from Editor to Formatting
  • Keywords needs-patch added; reporter-feedback removed

Is not valid HTML, but it will end up like this in the DOM:


However, WordPress adds the following before that:


If you enter the valid table from the DOM in the editor and save the post, not <br>'s are being printed anymore.

Sounds like a wpautop() to me.

#4 @Matthias Reuter
14 months ago

Seems to be a classical wpautop case. When inserting structured HTML into a post, linebreaks will be converted to <br> or <p> through wpautop.

There are plugins available to disable wpautop on certain posts: https://de.wordpress.org/plugins/toggle-wpautop/

This will require users to decide whether to:

  • disable wpautop when linebreak-formatted HTML is used. If you have a big site, you may insert many <p>-Tags and/or <br /> tags manually for formatting text.
  • keep wpautop enabled, but write all HTML in line.

This occurs too with linebreak-formatted div-tags etc.

I don't think this is a bug, as wpautop just does it's job and you should disable it when you work with complex HTML in your Post.

Note: See TracTickets for help on using tickets.