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

The administration part for my plugin is divided into several pages and for some pages I would like to enqueue a JS source which would add jQuery functionality to various elements.

Right now this is my approach:

function admin_register_init() {

 if ($_GET['page'] == 'worldexplorer_admin_location_hub')
  wp_enqueue_script('worldexplorer_admin_hub', WP_PLUGIN_URL.'/worldexplorer/admin/admin_hub.js');
add_action('admin_init', 'admin_register_init');

However, this requires me to check the page index of the $_GET array. Is there another way to achieve what I wish to do?

share|improve this question
up vote 2 down vote accepted

I believe there is a hook admin_print_scripts-{$page} which might fit.

See this Load scripts only on plugin pages

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.