WordPress.org

Ready to get started?Download WordPress

Forums

Retrieving Custom Taxonomy Results (2 posts)

  1. Manish
    Member
    Posted 2 years ago #

    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?

  2. vtxyzzy
    Member
    Posted 2 years ago #

    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>";
    }

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags