Category checkboxes in upload modal

In a project I’m working on, I’ve enabled categories for attachments using: register_taxonomy_for_object_type(‘category’, ‘attachment’); In the edit attachment screen in the Media Library you see the normal list of checkboxes, but in the upload modal categories are presented as a comma-separated list of slugs in a textfield, as if they were a non-hierarchical taxonomy. I’m … Read more

Media modal in IE9 not working when included from plugin with wp admin scripts minified

This issue occurs with custom code that uses the WP Media modal, such as https://github.com/humanmade/Custom-Meta-Boxes or https://wordpress.org/plugins/categories-images/ The modal window does not load in IE9, except if I add define(‘WP_SCRIPT_DEBUG’, true) so the wp admin scripts/styles are not minified. Buttons with the “button” class don’t get the styles applied for example, so I suppose that … Read more

Restrict file types in the uploader of a wp.media frame

When creating a wp.media frame in JS, is it possible to specify allowed file types for the uploads tab? wp.media({ title: ‘Pick a PDF’, button: { text: ‘Use this file…’ }, library: { type: ‘application/pdf’ }, multiple: false, // Is there a similar option to this that works? uploader: { type: ‘application/pdf’ } } Note: … Read more

Modify Custom Field in Media Library using JavaScript

I’ve added a custom field into my media attachments: function set_image_data( $form_fields, $post ) { $form_fields[‘text_color’] = array( ‘label’ => ‘Text Color’, ‘input’ => ‘text’, ‘value’ => get_post_meta( $post->ID, ‘_text_color’, true ) ); return $form_fields; } add_filter( ‘attachment_fields_to_edit’, ‘set_image_data’, 10, 2 ); Which is fine and dandy, but now I’d like to add Colorpicker ( … Read more

Wp3.5 Media Gallery Edit modal: change captions to title

How can i change those editing inputs to title from caption? Some sources i found about new upload system: Using the WordPress 3.5 Media Uploader within plugins How to Add the WordPress 3.5 Media Manager Interface Basically looking for a proper solution like this: // http://wordpress.org/support/topic/wp-35-any-way-to-default-add-media-to-upload-files#post-3709109 // If you want to have the editor default … Read more

What type of template are WP media-modal’s templates?

I was looking at the WordPress templates (html that’s written to the page instead of awkwardly adding strings in JS). There are a lot of templates like this in a post editor for example: <script type=”text/html” id=”tmpl-uploader-status-error”> <span class=”upload-error-filename”>{{{ data.filename }}}</span> <span class=”upload-error-message”>{{ data.message }}</span> </script> Now, I know these can be referenced with wp.media.template(‘uploader-status-error’)( … Read more