How to show WordPress related posts from tags

Below code will display related posts from tags.It uses the wp_query function to look matches from tags. Style the query according to your needs.

		$temp_post = $post;
		global $post;
		$tags = wp_get_post_tags($post->ID);
		if ($tags) {
			$tag_ids = array();
			foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
			'tag__in' => $tag_ids,
			'post__not_in' => array($post->ID),
		$new_query = new wp_query( $args );
		if( $new_query->have_posts() ) {
		echo '<h4>Related Posts</h4>';
		while( $new_query->have_posts() ) {
		<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
			<?php the_title(); ?>
		 <?php the_time('M j, Y') ?>
		 <?php the_excerpt();?>
		$post = $temp_post;

Related posts:

HTML5 page structure

HTML5 offers more powerful structure comparing to older versions of Html. There are many new …

Partner with Us

We are providing an exclusive partnership offer to individuals and companies who are interested in setting up their own web design & development company. For more information about how to partner with us, please contact us