Make WordPress Core

Opened 3 years ago

Last modified 11 months ago

#52567 new defect (bug)

Shortcodes in separate <p> tags appear on same line in browser

Reported by: pawanahluwalia's profile pawanahluwalia Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.6.1
Component: Shortcodes Keywords: needs-patch
Focuses: Cc:


Please see the posts at the link below:

This problem:

  • ONLY occurs with <p> tags
  • Only when no other item is between the tags except the shortcode.
  • It does NOT occur when using other tags, such as headings, lists, etc.
  • It does NOT occur if there is something before or after the shortcode in the same tag that is non-whitespace.

Attachments (1)

shortcode-p-tag.diff (993 bytes) - added by juzar 11 months ago.
shortcode p tag issue dif

Download all attachments as: .zip

Change History (3)

#1 @SergeyBiryukov
3 years ago

  • Component changed from General to Shortcodes

#2 @juzar
11 months ago

The issue of <p> tag in the shortcode seems to come from the fact that WordPress, add the p tag to every content blocks and then strips the <p> tag from the shortcode blocks, which is why it is causing this issue, this depends on which kind of feature request

If you have the shortcode in Gutenberg like this.

Then you would expect the first shortcode to not have the <p> tag associated with it and all others to have, but when you try to run that, you can find the shortcode except the heading tag one are stripped their <p> tag.

A possible solution might be to respect the p tag given in the shortcode block and when using the shortcode directly in the block and respect every paragraph block and the paragraph column in the classical editor also.

11 months ago

shortcode p tag issue dif

Note: See TracTickets for help on using tickets.