Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How would I call out additional posts that have a tag by that matches the current post's title? For example if the current posts is titled "opossum" I would like teasers from all posts tagged with "opossum" to show at the bottom of the page.

share|improve this question

migrated from Jun 22 '12 at 22:53

This question came from our site for professional and enthusiast programmers.

2 Answers 2

First you need to fetch the current category, then grab posts. So, try

global $post;
$category = get_the_category($post->ID);

$args = array( 'numberposts' => -1, 'offset'=> 1, 'category' => $category );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
share|improve this answer
I added that to my template now I'm getting 'Catchable fatal error: Object of class stdClass could not be converted to string in /mnt/www/wordpress/wp-includes/query.php on line 1450' – Sam Jun 22 '12 at 21:37
I have flagged this to be moved this to the StackOverflow for wordpress – Ryan B Jun 22 '12 at 21:41
$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.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.