Support » Plugins » Hacks » Tag picker for attachments

  • Resolved filipstefansson

    (@filipstefansson)


    I’ve added a taxonomy to use tags for attachments like so:

    $args = array(/*..*/)
    register_taxonomy( 'tags', array('attachment'), $args );

    It works fine on the attachment page, but not in the media popup where there’s just a basic input field instead of the picker you would expect.

    Is this a WordPress bug or am I missing something?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    It’s not a bug, and you’re not missing something, it’s just that you have a different expectation than what’s provided. Not wrong, just different.

    Taxonomies are really only for post objects, attachments being one. Images can never be post objects, that’s why there are attachment objects. In a sense it’d be logical for there to not be any taxonomy field at all in the media pop up since it does not have much to do the attachment, only the image.

    I see the attachment data in the media popup as a sort of quick edit screen like we see for posts on the post list table. So we are not provided with the full tag meta box like on the attachment screen, we get the minimal quick edit version as a convenience since we shouldn’t really expect anything at all.

    You obviously see things differently, there’s nothing wrong with that, but it is apparently not how the core developers see things either. If you really need something different, you’re free to develop something.

    Easier said than done, I know.

    @bcworkz:
    I’m not sure if I see things differently, I’m just trying to figure out whether or not I need to develop this on my own.

    I agree that if the modal is in fact just for the image, it would make more sense not to provide the basic input field there. It’s kind of confusing and feels/looks like something that’s still in development.

    Thanks for your answer!

    // apply tags to attachments
    function wpa_add_tags_to_attachments() {
        register_taxonomy_for_object_type( 'post_tag', 'attachment' );
    }
    add_action( 'init' , 'wpa_add_tags_to_attachments' );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Tag picker for attachments’ is closed to new replies.