Enqueueing Scripts for Theme Admin Pages
-
According to Make WordPress Themes all themes must use the action
admin_enqueue_script-appearance_page_$menu_slug
to enqueue scripts and styles for theme pages in the admin.For some reason, I can’t get this to work. I’ve created an admin page with the slug origin-styles. I’ve added an action for it using
add_action('admin_enqueue_script-appearance_page_origin-styles','origin_enqueue_function')
butorigin_enqueue_function
is never called.I did a full regex search of wp-admin (WordPress 3.4 Beta 4) and the only place an action is called with the string “admin_enqueue_script” in it is on line 68 of admin-header.php. To test, I added the following line to
admin-header.php
.do_action("admin_enqueue_script-$hook_suffix");
As expected,
origin_enqueue_function
started being called after I added this.Am I missing something here, or is using the action admin_enqueue_scripts still the only way to enqueue scripts for a theme admin page?
- The topic ‘Enqueueing Scripts for Theme Admin Pages’ is closed to new replies.