0

The default rendering of the h1 element of a wordpress post looks like this:

<h1 class="entry-title"> XYZ </h1>

I would like to add the id attribute to the h1 element with the value of the post's title. The result should look as follows

<h1 id="XYZ" class="entry-title"> XYZ </h1>

I have already looked through many posts here, but couldn't find an answer to my question. Shouldn't there be a simple filter for functions.php to override the rendering of the h1 element?

  • WordPress doesn’t render the h1 element. So there’s no hook. Your theme does. The h1 will be in your theme’s templates somewhere. – Jacob Peattie Sep 2 '18 at 14:47
  • just found it. looked in the wrong place the whole time. should I delete the question? – beta Sep 2 '18 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.