Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

wp-register-script

Where is the right place to register/enqueue scripts & styles

August 5, 2022August 4, 2022 by Magenaut

I am using WordPress 3.1.4 by now. I am confused with where (which hook) do I use:

Categories Q&A, Wordpress Tags hooks, wp-enqueue-script, wp-enqueue-style, wp-register-script, wp-register-style Leave a comment

When should I use wp_register_script() with wp_enqueue_script() vs just wp_enqueue_script()?

August 4, 2022August 3, 2022 by Magenaut

I’m having trouble understanding when you need to use wp_register_script(). Currently, I just use something like:

Categories Q&A, Wordpress Tags wp-enqueue-script, wp-register-script Leave a comment

Enqueue Scripts / Styles when shortcode is present

August 4, 2022August 3, 2022 by Magenaut

What is the idea way to register/enqueue scripts and/or styles for use in plugins?

Categories Q&A, Wordpress Tags conditional-content, shortcode, wp-enqueue-script, wp-register-script, wp-register-style Leave a comment

wp_register_script multiple identifiers?

August 4, 2022August 3, 2022 by Magenaut

In order to avoid poor performance with multiple <script> tags I do concatenation of scripts regularly and produce one single bundle.min.js JS file and 'jsbundle' identifier.

Categories Q&A, Wordpress Tags javascript, performance, scripts, wp-enqueue-script, wp-register-script Leave a comment

Register and enqueue conditional (browser-specific) javascript files?

August 4, 2022August 3, 2022 by Magenaut

The WP.SE community has always advised the use of wp_register_script and wp_enqueue_script for adding scripts in a theme/template (and likewise, wp_register_style and wp_enqueue_style for stylesheets).

Categories Q&A, Wordpress Tags javascript, wp-enqueue-script, wp-register-script Leave a comment

How to properly dequeue scripts and styles in child theme?

August 4, 2022August 3, 2022 by Magenaut

I made a parent theme and a child theme in one of my project. I enqueued CSS and JavaScripts in my parent theme like below:

Categories Q&A, Wordpress Tags child-theme, scripts, wp-enqueue-script, wp-register-script Leave a comment

Most elegant way to enqueue scripts in function.php with foreach loop

August 3, 2022August 2, 2022 by Magenaut

I wonder is there a way of running wp_register_script and enqueue with the help of foreach loop to manage label and dir?

Categories Q&A, Wordpress Tags functions, loop, php, wp-enqueue-script, wp-register-script Leave a comment

Hyphens vs. periods in the script slug in wp_register_script?

August 2, 2022August 1, 2022 by Magenaut

I have seen script and style handles written in two different ways in wp_register_script and wp_enqueue_script (the same applies to wp_register_style and wp_enqueue_style):

Categories Q&A, Wordpress Tags customization, wp-enqueue-script, wp-enqueue-style, wp-register-script Leave a comment

Check if a script/style was enqueued/registered

August 2, 2022August 1, 2022 by Magenaut

Is it possible to test whether a script or a style was registered using wp_register_script/_style or wp_enqueue_script/_style? All functions doesn’t return a value and I’m completely clueless.

Categories Q&A, Wordpress Tags wp-enqueue-script, wp-enqueue-style, wp-register-script, wp-register-style Leave a comment

wp_enqueue_scripts, wp_register_scripts, wp_print_scripts: i’m confused

August 2, 2022August 1, 2022 by Magenaut

I’ve been reading up a bit on this subject, but the more I read – the more confused I get.

Categories Q&A, Wordpress Tags css, javascript, wp-enqueue-script, wp-register-script Leave a comment
Older posts
Page1 Page2 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress