wp_enqueue_script with dependencies doesn’t work

This is a bug in WordPress. https://core.trac.wordpress.org/ticket/35873 As far as I can see, it can currently be fixed with https://core.trac.wordpress.org/attachment/ticket/35873/35873.3.patch, if you are reading this some time later, it has probably already been fixed for your WordPress version. As a temporary workaround, set parent dependencies to both child and grandchild. This way grandchild.js will not … Read more

How can I add my script to admin using script-loader.php?

I think you’e are only registering it with: $scripts->add( ‘user-profile-validator’, …) but not enqueueing it. Check e.g. how wp_register_script() is a wrapper for the WP_Scripts::add() method. Additionally add: wp_enqueue_script( ‘user-profile-validator’ ); in the relevant admin file to enqueue it or add it as a dependency for another enqueued script. Note that password-strength-meter is a dependency … Read more

Unable to load stylesheets and scripts to plugin settings page

The way to go was to use wp_enqueue_style() and wp_enqueue_script functions when admin_enqueue_scripts hooks. To register styles and scripts with wp_register_style and wp_register_script respectively is optional, but has some good advantages as nicely explained here. Here’s the working script: <?php /* Plugin Name: Awesome Slide Show */ // admin_init // ************************************************************************************************ function wp_ss_plugin_admin_init_cb() { // … Read more

Select2 in WordPress

It’s not. They may have been planning it for 4.1 or 4.2, as suggested in your link, but for whatever reason it never happened. You can see a list of core-registered scripts that you include here. Another thing to keep in mind is that many (arguably too many) plugins enqueue their own version of the … Read more

WordPress Script Loading/Unloading — wp_deregister_script(‘jquery’)

WordPress has essentially two groups of methods to handle scripts, both of which should be used: wp_register_script Registers a script in WordPress. It does not get called, it is just available for WordPress, if it is needed. wp_deregister_script is the exact opposite. It deletes the definitions made in wp_register_script, the script is no longer available … Read more

Why Allow Script Commands in Comments?

It is not “security risk” per se, as an admin can just go and add whatever stupid PHP code it likes via FTP which usually can do much more damage than some JS. If an admin does stupid things then there is nothing you should do about it as after all it is his site. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)