From wp_enqueue_scripts
action:
wp_enqueue_scripts
is the proper hook to use when enqueuing items that are meant to appear on the front end.
For admin-facing scripts, the correct action hook is admin_enqueue_scripts
function prefix_enqueue_scripts3() {
wp_enqueue_script(
'metabox_js',
get_stylesheet_directory_uri() . '/js/metabox.js',
array( 'jquery' ),
'1.0.0',
true
);
}
add_action( 'admin_enqueue_scripts', 'prefix_enqueue_scripts3' );
Related Posts:
- wp enqueue style on specific page templates
- How do I get the $handle for all enqueued scripts?
- How can I get a list of all enqueued scripts and styles?
- Load CSS/Javascript in frontend conditionally if block is used
- Register a script to be enqueued both in admin and front end
- Cannot deregister a script using wp_deregister_script
- Conditional wp_enqueue_script on a page
- Enqueue custom font file with rel=”preload”
- Why is jquery-ui-core enqueueing in my footer instead of the header?
- Using wp_enqueue_script on shortcode function handler
- Get the list of enqueued/registered scripts for a specific post?
- Add script to footer – on post editor
- Which action to hook wp_enqueue_script to? wp_head or wp_enqueue_scripts? [duplicate]
- enqueue and localize script in footer
- Conditionally dequeue dependency of scripts
- What determines the order of enqueued styles?
- Wp_head and wp_footer vs wp_enqueue_script javascript files?
- Enqueue script only if page has an oembed
- It would be a right way to enqueue the script using foreach loop?
- Is this a bad implementation of wp_enqueue_script for conditional usage?
- Don’t load scripts if on mobile/tablet
- How to Add a Custom Script to Customize.php
- Remove a script from a template file using wp_dequeue_script
- wp_enqueue_script vs. wp_register_script
- Child Theme – what is the scope of overwriting files?
- Enqueue scripts to footer
- Add last modified time as version to css and js
- Enqueue script on specific WooCommerce template
- Custom Plugin Development: What priority should wp_enqueue_scripts have?
- Select2 in WordPress
- How to switch css files according to devices and button click?
- How to control the order of the combination of enqueued styles and scripts – site speed issue
- Register script/style: Is it possible to customize the version query string via plugin?
- scripts not enqueueing
- Asset loading with gulp.js or Grunt
- Enqueue AWS Script
- How can I make sure my JS script gets executed first, among other scripts?
- How to load script-related styles automatically?
- Optimizing WordPress’s styles and scripts
- How do I enqueue a js file in functions.php for a if lt IE 9 statement? [duplicate]
- How to enqueue a style using wp_enqueue_scripts()?
- How to cancel `wp_print_scripts`?
- wp_head() – list hooked actions with priorities?
- getting a js file for one page
- enqueue admin styling and scripts only on plugin page
- wp_enqueue_script called incorrectly
- How to change script order?
- Enqueue script multiple times?
- Can’t see why my scripts aren’t loading when I register and enqueue them
- Including files in Child Themes
- Exclude external uri for css and js version
- WordPress script file version numbers changing in live environment
- Do I need to register my own created .js and .css files
- How to add parameter to wp_enqueue_script?
- Change script type and src of plugins in theme
- wp_dequeue_style and wp_dequeue_script not working on server but does work on local xampp
- wp enqueue, how to prevent duplication when same script is registered with different handles
- get_template_directory_uri not dependent on WP_HOME in wp-config.php?
- get_template_directory_uri() gives me wrong path when I try to use wp_enqueue_style
- why quotes shown in WordPress?
- Overwrite wp_enqueue_script under certain condition
- Custom script file enqueue has “?ver=4.5.1” when loading and doesn’t update
- Help to enqueue a js functions ( jquery) [closed]
- Enqueue script inside IE conditional comments
- Enqueueing Scripts and Styles
- JavaScript is not enqueuing
- How to load API’s in WordPress?
- Enqueue scripts based on options
- How to use wp_enqueue_script, style when required
- Adding Pinterest Script Before Closing Body Tag
- Enqueue Script in WordPress
- how to enqueu customiser/customizer scripts?
- how to enqueue javascript to manipulate acf input field in admin?
- Plugin add_action and add_menu_page
- load a different stylesheet in a category post
- How to register script with null value for version?
- is there a way to get all queued scripts/styles into a template without `get_header()`?
- How do I pass $in_foooter to wp_enqueue_script() without passing other params?
- How to do chunked JS files in WordPress?
- Copy permalink to clipboard automatically when publish/update posts?
- WordPress wp_enqueue_style and wp_enqueue_script not working
- Stylesheets and scripts not loading
- Scripts and stylesheets failing to load in Chrome IOS (and only Chrome IOS)
- Enqueue Script only over specific WordPress core file
- i can’t handle any style or Js file on my theme . what is the problem of this file?
- ajax jquery live search box not working in wordpress plugin
- Dealing with multiple Google maps API calls
- How can I remove the site URL from enqueued scripts and styles?
- Initializing scripts in wordpress
- wp_enqueue_script was called incorrectly… i want to work with debug on
- Loop through arguments of a function
- How do I display the handle for all front-end enqueued scripts in plugin options page?
- css3-mediaqueries-js failing with child theme
- Enqueueing Script to footer puts it at the very bottom
- wp_enqueue_scripts hangs
- Using wp_enqueue_script in a wordpress plugin
- wp_script_is(‘enqueued’) true, but file not requested in HTML
- How to enqueue js script after another specific js script?
- Should I use wp_register_style(), wp_enqueue_style, or both?
- How to give path to files in plugins folder?