Tag enqueue
How To Enqueue A Javascript File In The WordPress Admin
Use the admin_enqueue_scripts hook to load JS in the dashboard. The $hook parameter lets you limit the script to specific admin screens.
How To Register A Gutenberg Block With Plain Javascript In WordPress
You can register a simple block without a build step. Load the script in the editor with the enqueue_block_editor_assets hook and declare the WordPress packages as dependencies.
How To Use The WordPress Rest Api With Javascript Fetch
Expose the REST root URL and a nonce with wp_localize_script(), then call any endpoint from JS.
How To Remove A Script In WordPress With Wp_Dequeue_Script
Use wp_dequeue_script() and wp_deregister_script() with the script handle, hooked late so it runs after the script has been enqueued.
How To Add Inline Javascript In WordPress With Wp_Add_Inline_Script
Attach a small piece of JS to an already enqueued script. Use 'after' to print it after the script, or 'before' to print it before.


