Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Home.html displays title from query loop instead of post-title | GoodFirstPicks

Home.html displays title from query loop instead of post-title

WordPress/gutenberg 18 comments 1d ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeWordPressJavaScriptReact

Why this is a good first issue

Template hierarchy issue where post title incorrectly displays instead of page title in blog page context.

AI Summary

The issue involves incorrect title display in home.html template when used as a blog page, showing post title instead of page title. Requires understanding of WordPress template hierarchy and query loop behavior in block themes. Solution may involve template adjustments but scope isn't fully clear.

Issue Description

Description

As I am aware, assigning any page as the 'blog page' in WP reading settings, this will load home.php / home.html in the template hierarchy. This is the specific use case here.

In the home.html template, we want to add a post-title to the blogpage template, or in a template-part assigned to the home.html.

Problem: The title displays the title of first post in the loop. Not the page title (which is 'blog' in my case). The featured image block also displays the first posts' featured image, and the not the blogs (or none if it isnt assigned).

Expectation: It should display the title of the current page, not a post in the query loop.

I remember in the 'old days' this was a bug that occured when 'wp_reset_postdata' wasn't used correctly to close the loop. But i assume it works a little different in a block theme.

@everyone: this can be solved with manually placing a heading block, but the purpose of issues here is that we want this to work as expected or intended.

Step-by-step reproduction instructions

  1. Create a new page with title 'blog', in a fresh TT2 install (needs some demo content: a couple of posts).
  2. Go to WordPress settings / reading settings and set this page as 'blog-page'.
  3. Go to Site Editor, and open the Home.html template.
  4. In this template, add 'post-title' block and place it above the query loop (not in the query).
  5. Update, open front-end display and see that the title block displays the first title in the loop, instead of the title of the blog-page (blog).

Screenshots, screen recording, code snippet

Testing with post title in the 'header-dark-small' template-part: image Testing with post-title in the template itself: image

Environment info

  • WP 5.9.1
  • Gute

GitHub Labels

[Type] Bug[Block] Query Loop[Feature] Site Editor

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!

Risk Flags

  • template hierarchy
  • query loop behavior
Loading labels...

Details

Points20 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno