All web pages should have one and only one h1 tag, which indicates the beginning of the heading hierarchy for the page. In order to have a proper headline tag hierarchy on our sites, we make sure the core/site-title block is an h1 tag on the site's home page. That means no matter what the block's actual setting is, we need to make it an h1 on the home page. On internal pages, the core/site-title block should be a paragraph tag, because the core/page-title or core/post-title block is the h1.
Issue
In our functions.php file, on line 160, we're filtering the core/site-title block to make the change described above. However, the code only changes the first instance of the tag, leaving the closing tag untouched. That means on every home page, we creating broken HTML, such as <h1>[...]</p>. The string replace function is only replacing the opening tag and not the closing tag.
Background
All web pages should have one and only one
h1
tag, which indicates the beginning of the heading hierarchy for the page. In order to have a proper headline tag hierarchy on our sites, we make sure thecore/site-title
block is anh1
tag on the site's home page. That means no matter what the block's actual setting is, we need to make it anh1
on the home page. On internal pages, thecore/site-title
block should be a paragraph tag, because thecore/page-title
orcore/post-title
block is theh1
.Issue
In our functions.php file, on line 160, we're filtering the
core/site-title
block to make the change described above. However, the code only changes the first instance of the tag, leaving the closing tag untouched. That means on every home page, we creating broken HTML, such as<h1>[...]</p>
. The string replace function is only replacing the opening tag and not the closing tag.