Make WordPress Core

Opened 4 years ago

Last modified 18 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:

Description

Please see the posts at the link below:

https://wordpress.org/support/topic/shortcodes-in-separate-tags-appear-on-same-line-in-browser/#post-14065192

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 18 months ago.
shortcode p tag issue dif

Download all attachments as: .zip

Change History (3)

#1 @SergeyBiryukov
4 years ago

  • Component changed from General to Shortcodes

#2 @juzar
18 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.
https://drive.google.com/file/d/13G2JnuG88fsVNz2m5gfIrL0vMZ_4fDy0/view

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.

@juzar
18 months ago

shortcode p tag issue dif

Note: See TracTickets for help on using tickets.