Questions tagged [wp-register-script]

With `wp_register_script` it is possible to make WP aware of a script without actually loading it. It can later be loaded with `wp_enqueue_script`, but will also automatically load when another script is enqueued that depends on that script.

18 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
1answer
293 views

Register script version not showing

I want to implement cache busting on a specific script, but the version is not added to the url as query vars. Here is the code I'm using : wp_register_script( 'custom', ...
1
vote
0answers
2k views

wp_enqueue_script() doesn't work with AJAX

My problem is: I made an AJAX call using this code wp_enqueue_script( 'prefix-myscript-name', plugins_url( 'js/ajaxcall.js', __FILE__ ) ); I made the call and the AJAX just going fine. I used this ...
0
votes
0answers
37 views

Enqueue registered dependencies only when necessary

I'm developing plugin where I want to load my dependency JS libraries only when the setting is enabled. The most correct way is to register all the scripts and styles I have and then enqueue my main ...
0
votes
0answers
21 views

plugins_url not returning correct directory

This plugin works on my live wordpress instance. However, on my local machine, none of the javascript is getting triggered. I think it has to do with plugins_url and it most likely not returning the ...
0
votes
1answer
20 views

When to use wp_register_script() function?

When I came to know the function wp_register_script(), I had some questions came to my mind: Should I register each script first and then enqueue it? And is this a best practice? Or, Should I ...
0
votes
0answers
17 views

wp_register_script was called incorrectly file location

So I took over a site with 100+ plugins. I've reduced the plugin stack to 44. With WP_DEBUG enabled; I am getting a wp_register_script was called incorrectly warning. Is there an easy way to find ...
0
votes
1answer
134 views

Starting with tabbed metabox

I need a tabbed metabox for my plugin. Actually they are 5 metaboxes each one in a tab. I found these scripts: https://speckyboy.com/10-simple-code-snippets-creating-beautiful-tabs/ Which one is ...
0
votes
0answers
52 views

How do I keep children of certain parent menus expanded by default on a sidebar?

We are using advanced sidebar pages menu: https://wordpress.org/plugins/advanced-sidebar-menu/ to expand / collapse children menus on a sidebar. By default, the parent sidebar menu is expanded, ...
0
votes
1answer
116 views

How to call wp_localize_script() after the script?

I am trying to use the WordPress path URL in my js script file. I read here that I need to use wp_localize_script. But, I according to Codex's documentation wp_localize_script() MUST be called ...
0
votes
1answer
97 views

bundled jquery in theme js not working with wp_localize_script

I've bundled jquery in my theme js using grunt-uglify. Now I want to prevent wp jquery from loading since I don't need 2 jquery versions and want to save unnecessary requests. This is what I have: ...
0
votes
1answer
35 views

How to redirect new registrars to a custom registration page instead of WP default registration page?

How to redirect the user from this page domain.com/wp-login.php/action=register to another page?
0
votes
1answer
72 views

True parameter but jquery register in header and not in the footer with wp_register_script

I want to register jquery.js in the footer, but even with the true parameter it registers in the header. Here is the code. The other scripts are registered in the footer. Only jquery does not. ...
0
votes
0answers
586 views

How to wp_enqueue_script with html?

I want to wp_enqueue_script multiple javascript with html and css. I place the html code in a page, but it's not working on my side. Only plain text is displayed. Here's the link: http://goo.gl/...
0
votes
0answers
137 views

How do I get my theme scripts to load in a custom theme built from Bootstrap

I have created my own theme, pretty much from scratch, using Bootstrap 3.x. If just refer to the scripts from my footer.php file, it works. However, if I try to do it the right way, using ...
0
votes
1answer
213 views

can't access dashboard and showing forbidden page

i cant access my dashboard. after i make true the wp-debug it shows the following error. Notice: wp_register_script was called incorrectly. Scripts and styles should not be registered or enqueued ...
0
votes
1answer
211 views

Child Theme - what is the scope of overwriting files?

I noticed that creating twentythirteen-child/archive.php overwrites twentythirteen/archive.php but creating twentythirteen-child/shortcodes/drop-cap/drop-cap.php does not overwrite twentythirteen/...
0
votes
1answer
354 views

Remove snippets of JS from core

I can see these bits of code in the source in my wp install: <!-- jQuery --> <script type="text/html" id="tmpl-wp-playlist-current-item"> <# if ( data.image ) { #> <img ...
0
votes
1answer
323 views

wp wp_register_script function results type parameter missing

I used the following code wp_register_script('jquery', get_bloginfo('template_directory').'/js/jquery.js', false, '',false); wp_enqueue_script('jquery'); It includes the script as <...