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

I can not get colorbox fully loaded.

I am trying to add color box to use in my plugin admin.

I do not need it for the front end.

I can get the css but can not get jquery.colorbox-min.js or the inline script to load in the <head>.

Here is what I have:

/*    admin Stylesheet
add_action( 'admin_enqueue_scripts', 'add_wlmm_admin_stylesheets' );

function add_wlmm_admin_stylesheets() {
    if (is_admin()) {

         * Includes css for:
         *  - plugin optins framework
         *  - colorbox
      wp_enqueue_style( 'wlmm-admin-style', WLMM_URL . 'admin/css/wlmm-admin-styles.css' );

/*      load colorbox for admin help images

add_action( 'wp_enqueue_scripts', 'wlmm_do_colorbox_js' );
add_action( 'wp_head', 'wlmm_do_colorbox_script' );

function wlmm_do_colorbox_js() {

    if (is_admin()) {
      wp_enqueue_script( 'colorbox', WLMM_URL . 'admin/scripts/colorbox/jquery.colorbox-min.js', array( 'jquery' ) );

function wlmm_do_colorbox_script() {

if ( ! defined( 'COLORBOX_WIDTH' ) ) define( 'COLORBOX_WIDTH', '95' );
if ( ! defined( 'COLORBOX_HEIGHT' ) ) define( 'COLORBOX_HEIGHT', '95' );
if ( ! defined( 'COLORBOX_OPACITY' ) ) define( 'COLORBOX_OPACITY', '0.6' );

// Colorbox settings
echo '
  jQuery(document).ready(function () {
      jQuery("a.admin").colorbox({ width:'.COLORBOX_WIDTH.', height:'.COLORBOX_HEIGHT.', opacity:'.COLORBOX_OPACITY.' });
share|improve this question
up vote 1 down vote accepted

For the admin side, the two actions you want are admin_enqueue_scripts and admin_head-(plugin_page).

wp_enqueue_scripts and wp_head are only for the front end.

share|improve this answer
Got it working...but only as admin-head and not admin_head-admin.php would not work but admin_head works fine. The admin page is admin.php?page=admin_plugin_options. I should have caught the admin_enqueue but the amin_head-plugin_page was new. So it's working but I would rather have it only load for admin.php.......thanks for the help. – Jason Jan 10 '13 at 13:10

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.