Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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.