WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can get a modal window to work from within the wordpress admin?

I want to create a modal window that will work from a meta box within the wp-admin.

Any ideas?

share|improve this question
50% is pretty low - please remember to return to your old questions and accept correct answers. It takes them off the 'unanswered' pile and helps others find solutions more easily. People will also be more willing to offer answers if they know that the OP will respond to them. :) – Stephen Harris Apr 10 '12 at 15:47
up vote 9 down vote accepted

Give the anchor a class of thickbox and make sure that the thickbox script is enqueued on your admin page using add_thickbox



<a href="your url" class="thickbox">click here</a>

You can see what add_thickbox does here:


share|improve this answer
I think it might not be necessary to enqueue thickbox: it is automatically (at least in some instances) enqueued on a post edit page. See add_thickbox() too. – Stephen Harris Apr 10 '12 at 16:05
So how would I populate it with html? – Shae Apr 10 '12 at 17:41
Note your url, it loads the URL of the anchor into an iframe – Tom J Nowell Apr 10 '12 at 18:48
I just spent 40 minutes exporting modal only bootstrap css and JS and getting it into the dashboard -_-. Could have spent 30 seconds doing this... – Archonic Apr 29 '15 at 18:06

To use Thickbox for inline modal windows you can use the following code.

<?php add_thickbox(); ?>

<a href="#TB_inline?width=600&height=550&inlineId=modal-window-id" class="thickbox">Modal Me</a>

<div id="modal-window-id" style="display:none;">
    <p>Lorem Ipsum sit dolla amet.</p>


share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.