Template part - inconsistent / unwanted removal of <p>
tag by shortcode_unautop()
#33345
Labels
[Block] Template Part
Affects the Template Parts Block
[Feature] Shortcodes
Related to shortcode functionality
[Type] Bug
An existing feature does not function as intended
Description
While attempting to build a
metadates
block template part to display the Published and Last updated dates in a grid layoutI noticed some styling problems and determined that in some instances the
shortcode_unautop()
call intemplate-part.php
was responsible. Its continued use in Gutenberg was questioned in #26809.I wrote a post to demonstrate the problem. The fix is simple. Remove the call to
shortcode_unautop()
.Step-by-step reproduction instructions
See the video.
Expected behaviour
<p>
tags from paragraph blocks should not be removed programmatically byshortcode_unautop()
.Actual behaviour
When a template part is used from a custom template some
<p>
tags are removed programmatically byshortcode_unautop()
.Screenshots or screen recording (optional)
Code snippet (optional)
Commenting out the call to shortcode_unautop() resolves the issue.
WordPress information
Device information
The text was updated successfully, but these errors were encountered: