how to limit and display tag?

Try this:

   $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;
       }
   }

Leave a Comment