remove link from tags – WordPress

I am using the following code to display the tags on my WordPress site,

<?php the_tags( $before, $sep, $after ); ?> 

However it outputs

Read More
Tags: tag1, tag2 ....

I want to remove the ‘Tags’ lable that gets automatically put in front, as well REMOVE the link that is put on each tag (I want the word there but I don’t want it linking to anything.)

Related posts

1 comment

  1. Just and paste it inside the loop:

    $posttags = get_the_tags();
    
      $tags = array();
      if ($posttags) {
        foreach($posttags as $tag) {
          $tags[] = $tag->name;
        }
      }
      $newTags = implode($tags, ',');
    
      echo $newTags;
    

Comments are closed.