Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How do I remove the link generated by the_tags?

This is what I use today: <?php the_tags( '', '', '' ); ?>

That results in the tags assigned to the post. But I want to remove the link. Any idea?

share|improve this question

migrated from stackoverflow.com Feb 7 '12 at 15:04

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 2 down vote accepted

Use following code:

<?php
$posttags = get_the_tags();
if ($posttags) {
  foreach($posttags as $tag) {
    echo $tag->name . ' '; 
  }
}
?>

More details: http://wpeden.com/tipsntuts/getting-list-of-tags-for-a-post/

share|improve this answer

Get the tag list, and then strip the tags.

<?php
if (is_single()) { the_post(); rewind_posts();
  $articletags = strip_tags(get_the_tag_list('',', ',''));
  echo $articletags;
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.