What dependencies should I load and to use the WP_Filesystem?

What is the best way to load the dependencies for the WP_Filesystem? The first or the second code part? WP_Filesystem() is used in conjunction with the global $wp_filesystem variable, so if you use it, then the second code part should be used. And WP_Filesystem() must be called so that the global $wp_filesystem variable is properly … Read more

Can´t access child theme´s scripts dependencies found in parent

If the parent theme bundles all vendor scripts in one file, you can’t require/enqueue them separately. From WP’s point of view, they are one single resource/dependency. Look into any page’s source-code or use a plugin (such as “debug this”) to get the script’s register name so you could specify it as dependency. In your case … Read more

How to stop activating a plugin and show admin notice when dependent plugins minimum version is not met

You can add the following code in your plugin. I have used this in my ARB booking plugin and it worked perfectly. The full details of the code with explanation can be found here: class FT_AdminNotice { protected $min_wc=”5.0.0″; //replace ‘5.0.0’ with your dependent plugin version number /** * Register the activation hook */ public … Read more

How to provide a plugin which requires CMB2 (plugin dependencies)?

On your plugin activation hook method you can check if CMB plugin is installed and/or activated. You can check this using the following methods: is_plugin_active(): only available from within the admin pages function_exists() or class_exists(): available anywhere once they are PHP core methods If CMB is not installed, you can throw an error message in … Read more

JavaScript added as link/stylesheet

wp_enqueue_script is for… scripts. You want wp_enqueue_style (and wp_register_style) for stylesheets. Also note that you can enqueue as many things as you’d like in a single function, no need to create a separate function for each. You can also pass all the same arguments to enqueue as you do to register, no need to register … Read more

Loading jQuery in the footer after removing jQuery migrate?

There is much safer way of removing jquery-migrate… Your code is almost correct, but first you remove jQuery and then add it again. If dependencies for jQuery will change, then your code will cause problems. But you don’t have to remove script to change its dependencies. You can do exactly that: function remove_jquery_migrate( $scripts ) … Read more