

In the comments, butlerblog pointed out that according to the Plugin GuidelinesĮxecuting outside code within a plugin when not acting as a service is not allowed, for example:

Wp_enqueue_script( 'jquery-ui-autocomplete' ) Īs for the stylesheets: WordPress does not register jQuery UI styles by default! Wp_enqueue_script( 'jquery-ui-accordion' ) no need to enqueue -core, because dependancies are set Since you're not changing version number or anything, it is ok to only use the handle. Dependencies are already set, so you only need to enqueue the script you really need (and not the core). No dice.įirst of all, WordPress registers jQuery UI via wp_default_scripts(). I've also tried with a plain WP 4.8 installation with no plugins installed other than mine, and with the default twenty seventeen theme only. I've already tried with and without the jquery dependency explicitly specified in the third argument of the wp_enqueue_script calls. However the pages lack the tags for the jquery-ui library. I've checked that the code actually gets executed each page load. Wp_enqueue_script( 'jquery-ui-slider', false, array('jquery')) Wp_enqueue_script( 'jquery-ui-autocomplete', false, array('jquery')) Wp_enqueue_script( 'jquery-ui-accordion', false, array('jquery') )

Wp_enqueue_script( 'jquery-ui-mouse', false, array('jquery') ) Wp_enqueue_script( 'jquery-ui-widget', false, array('jquery') ) Wp_enqueue_script( 'jquery-ui-core', false, array('jquery') ) In the constructor of my class I call: add_action( 'wp_enqueue_scripts', array($this, 'enqueue_scripts') ) Īnd then, below: public function enqueue_scripts() There are already many questions similar to this one, but all answers I've found so far boil down to call wp_enqueue_script inside the wp_enqueue_scripts action hook, which I'm already doing. It seems that my wp_enqueue_script calls are simply ignored. I'm having a tough time including jquery-ui scripts and styles in my plugin.
