WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to pull just the tag names as an array collection in order to write them out as a simple listing, without links, but the array that's returned does not send the name as an indexible item.

array(2) {
  [0]=> string(129) "<a href='#' class='tag-link-31' title='1 topic' style='font-size: 8pt;'>tag 1</a>"
  [1]=> string(127) "<a href='#' class='tag-link-30' title='1 topic' style='font-size: 8pt;'>tag 2</a>"

Is there another method I can use to get the entire site's tag collection with just the tag names? This is my current code, but because of the array indexes, I get the links as well.

$tagNames = wp_tag_cloud('format=array');
echo implode($tagNames,", ");   
share|improve this question
up vote 4 down vote accepted

try :

function my_tag_list_123($sep){
    $tags = get_tags();

    foreach ($tags as $tag){
        $ret[]= $tag->name;
    return implode($sep, $ret);

and call it when you need like this

echo my_tag_list_123(',');

hope this helps.

share|improve this answer
Thanks very much. That did it. Can get_tags() be used to find matches on the current post only, if in the loop? – Scott B Feb 9 '11 at 20:18
Use get_the_tags() in place of get_tags.. codex.wordpress.org/Function_Reference/get_the_tags – t31os Feb 10 '11 at 12:27
        $args = array(
        'smallest'                  => 12, 
        'largest'                   => 12,
        'unit'                      => 'pt', 
        'number'                    => 0,  
        'format'                    => 'array',
        'separator'                 => "",
        'orderby'                   => 'name', 
        'order'                     => 'ASC',
        'exclude'                   => null, 
        'include'                   => null, 
        'topic_count_text_callback' => default_topic_count_text,
        'link'                      => 'view', 
        'taxonomy'                  => 'post_tag', 
        'echo'                      => true,
        'child_of'                  => null, // see Note!

        $myCloud = wp_tag_cloud( $args );

        foreach ($myCloud as $tag) {
            $tag = strip_tags($tag);
            echo '<li>' . $tag . '</li>';
share|improve this answer
Please explain your code. Dumping of code like this without any explanation does not make a good answer and should be avoided. Please file an edit and add a proper explanation how your code works – Pieter Goosen Nov 3 '14 at 15:46

Your Answer


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.