No results found. Try again with different words?

Search must be at least 3 characters.

Changing the Post Title’s Tag of the Related Post Section

Sidebar Image

Did not find a solution? We are here to help you succeed.

If you have enabled related posts on your Blog posts, you might have noticed that the Post Title’s Tag of the Related Post Section has the <h3> heading tag assigned by default.

You can modify this tag to any other HTML tag by adding a filter to the functions.php file of your Astra Child Theme. If you don’t have a Child Theme installed and activated on your website, please check this article on how to do this

How Can I Do This?

You can use the filter below to change the Post Title’s Tag of the Related Post Section to any other tag. Please follow these steps:

Step 1 – Navigate to Dashboard > Appearance > Theme Editor and select the Child Theme;

Step 2 – Add the filter below to the functions.php file of your Child Theme. You can check this article on adding code to your Child Theme to help you out;

add_filter( 'astra_related_post_title_tag', 'update_related_posts_title_tag' );
function update_related_posts_title_tag(){
    return 'span';
}

Step 3 – The span in the code above can be changed to any preferred tag. If you add return ‘h4’; , click the “Update File” button to apply changes. The filter will change the default <h3> tag to the <h4> tag.

Default Tag

Post Title’s Tag of the Related Post Section after adding the Filter

Was this article helpful?
Sidebar Image

Did not find a solution? We are here to help you succeed.

Related Docs

Join 1,653,898+ Happy Site Owners Using Astra

Whether you are a beginner, small business owner, or professional web developer, Astra provides all the tools you need to easily build your beautiful WordPress website.

REWIND

YEAR IN REVIEW

Download is Just A Click Away!

Membership Retention Checklist Download

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form
Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form