Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to make use of the new Media taxonomy functionality to create a more robust media library. I've hit a bit of a brick wall with actually assigning uploaded media items to categories. I've set up the custom taxonomy and called it Media Categories (wcmedia), and it is working just fine, but the issue is that the media modal on the posts screen (Add Media) is not recognising the fact I've selected hierarchical. The hierarchical display seems to work fine on the actual edit media page, but it's on actual upload where it would be most useful (otherwise users need to upload and then navigate away to the actual edit media page and assign the category from there).

There seems to a couple of robust plugins that offer this sort of fucntionality, but I'm keen to avoid using a full-scale plugin what I'm hoping is just a few line fix. I don't even know why the default functionality of hierarchical category isn't honoured on the Add Media modal by default? Perhaps it is and I'm just missing something?

I think I have tracked down the function where the Add Media modal is pulling in the box for the Media Categories (get_compat_media_markup), but I'm not sure if/how to hook into it to alter the output.

I've included a screenshot to illustrate the issue more clearly.

media modal

share|improve this question
This will likely require JS code, and recreation of the media categories box from scratch. It's not ideal/trivial, a shame really. Eitherway functionally this is not broken, it's merely a UI thing. Nothing stopping you typing Liverpool and assigning a media category, sure it looks like a tag, but if you go into the edit media page it's assigned correctly – Tom J Nowell Jan 25 at 15:40
The new media library gotta be the less documented new feature in recent history... Yes, it's weird that a hierarchical taxonomy is displayed in a textarea like tags. [wp-hackers] mail list seems strangely silent when asked anything related to this... maybe because there's no answer, simply a "wait until further developments". – brasofilo Jan 25 at 15:40
Also to keep in mind, in the above if say you wanted an image in the Arsenal category, you only need to check arsenal, you don't need to check football, it's already implied by the parent child association that football will contain everything contained by arsenal – Tom J Nowell Jan 25 at 15:41
Yea, I did notice that it does "work". While it's fine for already created categories, there's obviously no way of creating the new category there and then and have it be a child of another category. So in my example if the football team "Everton" doesn't already exist... typing in "Everton" into the basic tag style input box will simply create a new root level category. I'll have another go at checking out what the plugins are doing to create the category select box. – Peter Willis III Jan 25 at 16:02

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.