Get Tag Slugs that start with a word

I think its easier to get them all and filter the ones starting with author:

<?php
$tags = get_terms( 'tags', array(
    'hide_empty' => 0
));
if ( !empty( $tags ) && !is_wp_error( $tags ) ): ?>
    <ul>
    <?php foreach ( $tags as $tag ): ?>
        <?php if(strpos($tag->slug,'author-') !== false): ?>
        <li><?php echo $tag->name; ?></li>
        <?php endif; ?>
    <?php endforeach; ?>
    </ul>
<?php endif; ?>

If you have lots of tags, you can use the transient api to store the results. I didn’t tried this, but it should work fine. This will store the tags for 1 day:

http://pastebin.com/dNVkuHAb

  • Also, you might want to store only the necessary info in the transient api, not the whole array of stuff, so only the name and the id would be fine, but you get the idea.