Support » Themes and Templates » Taxonomy Dropdown

  • Resolved jasonsweb

    (@jasonsweb)


    Hi!

    For my custom theme I’m trying to populate a dropdown menu in my meta box with my custom taxonomies.

    I’m using this code to get the custom taxonomies:

    $types = get_terms('portfolio-category');
    $types_array[0] = 'Select all';

    if ($types) {
    foreach($types as $type) {
    $types_array[$type->term_id] = $type->name;
    }
    }

    But then I’m getting this error in my WP-admin:
    Trying to get property of non-object

    Really, I don’t have any idea what I’m doing wrong??

    Thanks in advance!

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Taxonomy Dropdown’ is closed to new replies.