<?php $posttags = get_the_tags(); $count=0; if ($posttags) { foreach($posttags as $tag) { $count++; echo '<a href="'.get_tag_link($tag->term_id).'">'.$tag->name.'</a> '; if( $count >4 ) break; } } ?>