• keendev

    (@keendev)


    Hi All,

    I’ve got an interesting question I’d like to pose to you all, this might be a better fit for the advanced forum. However here goes:

    Below is an image:

    Media Gallery Example

    I currently have Wp Media Gallery plugin installed.

    Wp Media Gallery

    Now inside this plugin the author registers the category taxonomy to the attachment post type, now thats all nice and dandy. This will make a category taxonomy text field show up in the attachment details section (highlighted in red in image above). Now what I’d like to know is:

    1. Where is the code in the wordpress core which decides to add a field there?
    2. Is it possible to add other fields their that will get saved as well. (Most likely a taxonomy)

    Kind Regards

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

    (@bcworkz)

    Sorry for the late reply, I wasn’t able to poke around on my site until now. I’ve no idea where the code for taxonomy fields lies. Most of the fields are from media-template.php, but where the taxonomy field would show up on this template, no related code is there. Thus I suspect it is injected via jQuery at some point during the page load.

    As long as your field is for a taxonomy term and you register your taxonomy for attachments just as the plugin author did for categories, the input will be handled automatically for you.

    You could probably add other non-taxonomy fields with jQuery, then identify an action to hook from which to save the entered data, but I’ve no idea what that code may look like, so I’d suggest sticking with taxonomies.

    Thread Starter keendev

    (@keendev)

    Thanks bcworkz,

    I’ve decided to go along with the taxonomy approach. Seems like the best approach, unfortunately it doesn’t allow adding custom fields through actions and filters since its much cleaner then injecting via jquery.

    Either way thanks for taking the time to look into this, it is much appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Media Gallery Attachment Details Category Taxonomy’ is closed to new replies.