Support » Fixing WordPress » get_terms doesn't work with custom attachment taxonomy

  • I created a custom taxonomy for the attachments in my site, so that I can keep them organized by section. However, when I went to create a drop-down filter for them, as I’ve done on custom post types before, it didn’t work.

    After some digging, I found that the function “get_terms” was not returning anything for my custom taxonomy. Also, the count for my terms under the admin page does not update when I associate images with the custom taxonomy terms, they just remain at 0.

    This guy seems to think that it’s because you have to attach an image to a page before WordPress takes notice of it. I tried attaching one of my images to a page and associating it with a custom taxonomy, but that didn’t change anything.

    I did some more testing, and found that “get_term(term_id, ‘attachment_tax’)” and “get_term_by(‘slug’, ‘term_slug’, ‘attachment_tax’)” both work, but “get_terms(‘attachment_tax’)” does not.

    Is this a bug? If so, when can we expect to see it fixed? This is crucial in order to make the media library more navigable for my users.

    Thanks,

    Josh

  • The topic ‘get_terms doesn't work with custom attachment taxonomy’ is closed to new replies.