name_like argument using get_tags (3 posts)

  1. icarusgraeme
    Posted 7 years ago #

    I'm trying to use get_tags to display tags starting with specific letters. From the get_tags page in the codex, it sounds like I can use the "name_like"argument can do this for me, but it's not working (by which I mean, it still shows all the tags, not just the ones that start with "a"). I've tried every other argument for that function and they all work fine.

    Here's my code. Am I missing something?

    $tags = get_tags('name_like=a');
    if ($tags) {
    foreach ($tags as $tag) {
    echo '<p><a href="' . get_tag_link( $tag->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . '>' . $tag->name.'</a> </p> ';
  2. esmi
    Forum Moderator
    Posted 7 years ago #

    Try name__like.

    Two underscores.

  3. icarusgraeme
    Posted 7 years ago #

    Beautiful! Thanks. I thought that underscore on the function page looked a little long.


Topic Closed

This topic has been closed to new replies.

About this Topic