From where come that JS files in ?

Quick but not recommended solution – remove wp_head() function from your header.php file. NOT RECOMMENDED, because new plugins may not work once you did this. The best way is to find that files in you theme code, just perform a search within your theme files for wp_enqueue_script – you have to find the hook where … Read more

What is the purpose of the wp_enqueue_script() handle?

Below is an example of the jquery handle being used in various ways: // add my js, written in jQuery // so it requires `jquery.min.js` to be output first // & say I do this in a early hook like `init` wp_enqueue_script( ‘my-js’, ‘js.js’, array(‘jquery’)); // later in theme: // remove WordPress’s default jquery, // … Read more

Correct way to use register_activation_hook

This quotation from The Codex clearly states what does this function do: The register_activation_hook function registers a plugin function to be run when the plugin is activated. This means, this function works similar as a class’s __construct() method. You can use it to set initial options, update database, and more. It doesn’t run every time … Read more

How to get CMB2 to show a single image at a specific size

You can get ID of the attachment, and then use that to get whichever size you need. https://github.com/CMB2/CMB2/wiki/Field-Types#file A file uploader. By default it will store the file url and allow either attachments or URLs. This field type will also store the attachment ID (useful for getting different image sizes). It will store it in … 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

Accessing plugin functionality within WP REST API

I have figured out the problem, after trying a load of things I wanted to double check plugins weren’t being loaded at all within the REST API. I added some rudimentary debugging to the plugin in question and I saw that the plugin was indeed being loaded, my issue was that in these conditions the … Read more