Make WordPress Core

Opened 4 weeks ago

Closed 4 weeks ago

#62827 closed defect (bug) (invalid)

get_the_content() is not generating group blocks wp-block-group__inner container

Reported by: fahrenheitch's profile fahrenheitch Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.6.2
Component: General Keywords: needs-patch reporter-feedback
Focuses: css, template, coding-standards Cc:

Description

If you have a shortcode, that outputs content from a custom post type in your theme somewhere, the get_the_content() function is not returning the usual html structure for the Group-Block.

regular output:

<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained">content here</div></div>

output by get_the_content():

<div class="wp-block-group">content here</div>

The extra container is missing, but it should be returned as well to have consistend output, no matter how the output is generated.

Change History (2)

#1 @poena
4 weeks ago

  • Keywords reporter-feedback added
  • Severity changed from major to normal

Hi @fahrenheitch and welcome to WordPress trac.

The inner div on the group is added by a filter, so perhaps the filter is not applied, I did not dig further.

https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/block-supports/layout.php#L969

Can you please include detailed step-by-step instructions for how to test this issue.
Including:
The code for the shortcode registration.
The context and complete code for the use of get_the_content.
The original block markup.

#2 @fahrenheitch
4 weeks ago

  • Resolution set to invalid
  • Status changed from new to closed

Hello,

Thanks for checking!

You're right, it was due to the missing the_content filter.

But to be honestly, I can't think of a scenario, where the_content filter will not have to be applied to generate a proper output. So I do not fully understand, why it is implemented like this.

Some background information would be helpfull.

Best, Andi

Note: See TracTickets for help on using tickets.