Instead of hooking into admin_print_scripts
only, you should hook into your specific page slug which is appended to admin_print_scripts-
. (note trailing hyphen). The reference page you linked to shows this, but you seem to be omitting the $page
concatenation to admin_print_scripts-
.
eg:
$page = add_theme_page( 'Options', 'Options', 'edit_theme_options', 'options-panel', 'topf_admin_options_markup' );
add_action( "admin_print_scripts-$page", 'enqueue_my_admin_scripts' );
I’m using the slug $page
returned from add_theme_page;
you should provide your own slug. Scripts will only be loaded for your specific page and there is no need to check within your enqueue function.