• I’m using this code in the header to show tags like meta keywords

    <meta name="keywords" content="<?php
    if(is_single()) {foreach(get_the_tags($post->ID) as $tag) {
          echo $tag->name . ', ';
       }}
    ?>">

    but the last tag have the “,” , how can i solve this ?

Viewing 1 replies (of 1 total)
  • Something like:

    <meta name="keywords" content="<?php
    $metas='';
    if(is_single()) {foreach(get_the_tags($post->ID) as $tag) {
          $metas .= $tag->name . ', ';
       }
    echo substr($metas,0,-1);
    }
    ?>">

Viewing 1 replies (of 1 total)
  • The topic ‘Tags like meta keywords’ is closed to new replies.