WordPress.org

Support

Support » How-To and Troubleshooting » Retrieving Custom Taxonomy Results

Retrieving Custom Taxonomy Results

  • Manish

    @financetrain

    I have a custom taxonomy called “Terms”.

    Now what I want to do is retrieve all the Terms starting with a particular Letter such as “a” or “b”. How can I do that?

Viewing 1 replies (of 1 total)
  • vtxyzzy

    @vtxyzzy

    You can use the get_terms() function as described in the Codex here:
    http://codex.wordpress.org/Function_Reference/get_terms

    For example, this should get all Terms starting with ‘e’:

    $terms = get_terms('terms',array('name__like' => 'e', 'hide_empty' => false));
    foreach ($terms as $term) {
       echo "<p>ID:$term->term_id  NAME:$term->name</p>";
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Retrieving Custom Taxonomy Results’ is closed to new replies.
Skip to toolbar