Which action to hook wp_enqueue_script to? wp_head or wp_enqueue_scripts? [duplicate]
I took a long time figure out the right way for this! Here’s what I follow now: Use case: In a plugin’s admin page Hook: admin_print_scripts-<page hook> OR <the php file name for your plugin> $hook = add_menu_page(…) / add_submenu_page(…); add_action(‘admin_print_scripts-‘.$hook, ‘my_callback’); Use case: On all admin pages Hook: admin_print_scripts add_action(‘admin_print_scripts’, ‘my_callback’); Use case: On … Read more