Make WordPress Core

Opened 6 weeks ago

Closed 4 weeks ago

#65586 closed task (blessed) (fixed)

Backport Latest Posts Parse blocks in full content display

Reported by: get_dave Owned by:
Priority: normal Milestone: 7.1
Component: Editor Version:
Severity: normal Keywords: gutenberg-merge has-patch
Cc: Focuses:

Description

Change History (12)

This ticket was mentioned in PR #12421 on WordPress/wordpress-develop by @get_dave.


6 weeks ago
#1

  • Keywords has-patch has-unit-tests added

This PR backports the Latest Posts full-content rendering fix from https://github.com/WordPress/gutenberg/pull/74866.

When the Latest Posts block is configured to show full post content, post content is now processed through the block content rendering pipeline instead of outputting raw block markup. This ensures nested blocks in the displayed post content render with their expected markup, attributes, styles, embeds, and media handling.

The change also adds recursion protection for Latest Posts blocks that render posts containing another Latest Posts block, and preserves the outer post context after nested rendering.

## Use of AI Tools

AI assistance: Yes
Tool(s): ChatGPT / Codex
Model(s): GPT-5
Used for: Backport implementation, test scaffolding, command execution, and PR description drafting. Final code, tests, and commit were reviewed by me.

#2 @wildworks
6 weeks ago

  • Keywords gutenberg-merge added

@wildworks commented on PR #12421:


5 weeks ago
#3

I have updated this PR according to https://github.com/WordPress/gutenberg/pull/80191. This PR should simply add the _wp_apply_block_content_filters function and unit tests.

@wildworks commented on PR #12421:


5 weeks ago
#4

I have removed the unit tests from this PR. This PR needs to be committed before today's Gutenberg sync, otherwise the non-existent _wp_apply_content_filters function will be executed during server-side rendering of blocks, causing a critical error. If no one else can review it, I will commit it myself before the Gutenberg sync.

#5 @wildworks
5 weeks ago

In 62726:

Editor: Add a helper to apply content filters within blocks.

Introduce the private _wp_apply_block_content_filters() function so that blocks rendering full post content, such as Latest Posts, process it through the standard content pipeline with optional recursion protection, instead of outputting raw block markup.

Discussed in: https://github.com/WordPress/wordpress-develop/pull/12421

Props get_dave, wildworks.
See #65586.

#6 @wildworks
5 weeks ago

  • Keywords needs-patch added; has-patch has-unit-tests removed

@get_dave @scruffian @onemaggie, To avoid the risk of critical errors when Gutenberg is synced to the core, I have temporarily committed only private functions. However, I believe unit tests are necessary for this function, so I would appreciate it if you could add them in a follow-up.

#7 @get_dave
5 weeks ago

@wildworks Sure and thanks for picking up this work. I'll raise a PR for unit tests now.

@get_dave commented on PR #12421:


5 weeks ago
#8

@getdave @scruffian @MaggieCabrera, Is it possible to move this PR forward to meet the Beta 1 deadline? At a minimum, the changes in the following two files need to be reverted, as they are automatically synchronized from Gutenberg.

  • src/wp-includes/blocks/latest-posts.php
  • src/wp-includes/blocks/template-part.php

Apologies but I somehow missed this ping. I really appreciate you wrangling this here 🙇

#9 @get_dave
5 weeks ago

In 62758:

Editor: Add unit tests for _wp_apply_block_content_filters().

Adds PHPUnit coverage for the private _wp_apply_block_content_filters()
helper, which is used by the Latest Posts block's full-content
rendering support. The helper itself and the Latest Posts change have
already landed separately.

The new tests cover applying the expected content filters, rendering
block markup returned by shortcodes, passing the image filter context
through, processing embeds, and clearing recursion-guard state after
both successful and exceptional block rendering.

Props get_dave, wildworks, scruffian.
See #65586.

#11 @irozum
4 weeks ago

  • Keywords has-patch added; needs-patch removed

#12 @wildworks
4 weeks ago

  • Resolutionfixed
  • Status assignedclosed

I believe there is nothing else to address in this ticket, so I will close it.

Note: See TracTickets for help on using tickets.