I came here for the same request and also to add an aria-label field. Bummer that I’ll have to add a new field for every field or try acf extended plugin. Accessibility is important
Late response 🙂
Following the instructions here, you can create a “category” field and attach it to any media.
https://www.advancedcustomfields.com/resources/adding-fields-media-attachments/
Thank you John, this was incredibly helpful. I used this to ensure that only specific field groups get saved to a specific plugin // theme I am writing. That way I can and edit all plugins and themes at the same time without worrying about the json getting mixed up.
@marknotton Not to be nitpicky, but please localize your Ajax URL!
as such:
wp_localize_script('my_js_scripts', 'MyAjax',
array(
'ajaxurl' => admin_url('admin-ajax.php'),
'postCommentNonce' => wp_create_nonce('myajax-post-comment-nonce')
)
);