Autoptimize does not aggregate registerred-only scripts

[ad_1]

Depending on a script that is only registerred and not enqued, does not work with Autoptimize’s aggregate function.

wp_register_script('script-a', '/script-a.js'), array());
wp_enqueue_script('script-b', '/script-a.js'), array('jquery', 'script-a'));

In the example above script-a is missing when Autoptimize is active with aggregate (autoptimize_js_aggregate). Disabling Autoptimize or switching to defer only (autoptimize_js_defer_not_aggregate). Fixes the issue.

I don’t know which version introduced this error. We are currently using version 3.1.11.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer