Articles of media modal

WordPress Built In Dialog Box For My Plugin

I need a modal box like media upload in post edit page. but in that I just need to insert a html form using AJAX call .. I tried to get the output, but I cannot, so I tried ThickBox and I got the output like shown below, but there are 2 issues. Model I […]

How to check an ajax nonce in PHP

I’m modifying the media modal adding a new menu item to add external attachments to the media library. From the JS code I’m calling a PHP function that touches the database and accepts three parameters (url, post id and nonce). My question is, how can I check the nonce from the PHP code? Another question, […]

Change Media modal image size

When i create a page, and click “Add media” button above the TinyMCE editor, the Media Modal shows up. Question: How do i edit the size of the images showing in the modal? The current images are full size, causing the browser to load very slow and in some cases the browser crashes (most browsers […]

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 […]

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‘uploader-status-error’)( […]

Adding fields to the media uploader with jquery listeners

So I have the code to successfully add a select field to my media uploader (gallery view) which is cool, but I also need to add some jquery listeners to that field. I’m using the ‘print_media_templates’ hook to add my markup and js, and I want to add a jQuery listener to the select field, […]

Run script after clicking Set Featured Image in Media

I would like to run some script to get the featured image’s width and height after the user clicked ‘Use Featured Image’ button and use the data retrieved within the Post Edit screen. Is there such hook available for use in JavaScript? Otherwise, do you have other suggestions to achieve this? Thanks for helping! Edit […]

How do I add the data-toggle=“modal” data-target=“#myModal” attribures to a WP Nav bar?

I’m new to WordPress so please be patient! I’ve created a template in html5/ccs3 and am in the process of trying to make a wordpress template out of it. In my navigation menu (in html) I have a social menu that opens 3 different modals: <social-icons> <div class=”navbar-collapse collapse”> <div class=”btn-group nav navbar-nav navbar-right” role=”group”> […]

List of available events for

Is there a list of available events for object? By doing some googling, I managed to find following events: for open, ready – they are triggered, when user opens the Modal window. The reason why I need this list is that I want to insert a select box on the right side, when […]

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 or 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 […]