Skip to content

Snippet: Change the Related Post Title Heading Tag

The default related post title heading tag is an h4 but you can easily change this to anything you want with a little code. Note: Changing the heading tag will not affect the design, only the tag itself. This change would be done purely for SEO reasons.

/**
 * Change the HTML tag for the related posts heading.
 *
 * @link https://totalwptheme.com/docs/snippets/change-the-related-post-title-heading-tag/
 */
add_filter( 'wpex_heading_blog_related', function( $args ) {
    $args['tag'] = 'h3';
    return $args;
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top