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

Not sure what I'm doing wrong, but I could use some help.

My plugin architecture is below...

register_activation_hook(__FILE__, 'my_post_options_box');
add_action('admin_menu', 'my_post_options_box');

//enqueue jquery ui here
function my_load_js() {
    echo "called"; //THIS ECHO FIRES

function my_post_options_box() {
    add_action( 'admin_init', 'my_load_js' );//DOES NOT LOAD THE .JS
    $my_dir = plugins_url('/img', __FILE__);
    add_options_page( '...my options page settings here');
    register_setting( 'my_settings_options', 'my_settings', 'my_settings_validate' );

Not sure what I'm doing wrong but when I view the source of the page in which the plugin is loaded, there is no .js file loaded for the jquery ui files I'm trying to enqueue

share|improve this question
up vote 3 down vote accepted

Hook my_load_js() to wp_enqueue_scripts as in the examples in the Codex, and not to admin_init.

add_action('wp_enqueue_scripts', 'my_load_js');

...pretty sure that will take care of it.

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.