Display posts with tag that matches current post title

How would I show posts that have a tag who’s name matches the title of the current post?
For example if you are on a post called “Hippo” at the bottom of the page I would like posts with the tag “Hippo” to be displayed.

Related posts

Leave a Reply

1 comment

  1. The query would look something like this:

    $title_tagged_posts_query = new WP_Query( array(
        'tag' => strtolower( get_the_title() )
    ) );
    
    while ( $title_tagged_posts_query->have_posts() ) : $title_tagged_posts_query->the_post();
        //Output whatever you want here.
    endwhile;
    

    This assumes that the tag slug for “Hippo” is “hippo”, which should normally be the case.