Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've added a new taxonomy for the medias post type:

function register_taxonomy_for_images()
{
    register_taxonomy_for_object_type('category', 'attachment');
}

add_action('init', 'register_taxonomy_for_images');

And I've added a few categories via wordpress admin.How can I get an array of all the media categories that I added? I've tried get_categories() but it doesn't work.

share|improve this question

1 Answer 1

Found the answer:

$categories = get_terms( 'category', array('hide_empty' => false) );
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.