Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed post content rendering issue on latest post block #69466

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

sabbir1991
Copy link
Contributor

What?

#69427

In this PR, I fixed the post content rendering on the latest-posts block when the displayPostContent setting is enabled.

Why?

The issue was on the latest-posts block, the post content rendered with block comments, and those block contents were not parsed. In this fix, I used the filter to parse the content.

Testing Instructions

  • Create a few posts.
  • Insert a latest posts block.
  • Save and view the HTML of the latest posts block on the front of the site.

Screenshots or screencast

Check the inspect element.

Before After
Screenshot 2025-03-06 at 3 34 35 PM Screenshot 2025-03-06 at 3 38 50 PM

Copy link

github-actions bot commented Mar 6, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: sabbir1991 <[email protected]>
Co-authored-by: carolinan <[email protected]>
Co-authored-by: renatho <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Mar 6, 2025
Copy link

github-actions bot commented Mar 6, 2025

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @sabbir1991! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@carolinan
Copy link
Contributor

I have 10 posts on my test installation. When I try to open my test post that has the latest posts block, I am getting this error:
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes)

@sabbir1991
Copy link
Contributor Author

Hi @carolinan. I tested with 12 posts in the frontend and backend but can't reproduce any of the errors that you mentioned. Is that error showing on the front end or back end?

@carolinan
Copy link
Contributor

Both
Did you set the latest posts block to use the post content, not the excerpt?

@sabbir1991
Copy link
Contributor Author

Yes, I have set post content with Full post settings.

Screenshot 2025-03-07 at 5 03 13 PM

@carolinan
Copy link
Contributor

I will try again on a different installation, perhaps on a Mac, but I won't have time today.

@carolinan
Copy link
Contributor

I have tried again and the same error shows. Try adding more than one latest posts block to the same post. I think there is an infinite loop, I am not sure how else this error would happen.

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Block] Latest Posts Affects the Latest Posts Block labels Mar 10, 2025
@renatho
Copy link
Contributor

renatho commented Mar 10, 2025

Just adding a note here that it also partially fixes this issue: #69517. It continues broken on the editor though.

@renatho
Copy link
Contributor

renatho commented Mar 11, 2025

Just adding a note here that it also partially fixes this issue: #69517. It continues broken on the editor though.

I tested #61477, and this PR also fixes this issue in the frontend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Latest Posts Affects the Latest Posts Block First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants