You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the new version of the plugin @fabrizim has set the compiler to initalize at 'init' priority 1, however the documented method for registering variables uses the functions.php file, which is executed BEFORE the 'init' action in the page life-cycle.
This results in the following error:
Fatal error: Call to a member function setVariables() on a non-object in /bedrock/web/app/plugins/wp-less/lib/Plugin.class.php on line 319
The solution was to call the variable registration with a hook after the init@1:
add_action('init', 'tws_redux_to_less_vars', 2); // The WP-LESS compiler is instantiated in 'init' priority 1.
function tws_redux_to_less_vars() {
// Pass LESS variables from reduxlessvars option to the LESS plugin class
if (class_exists('WPLessPlugin')){
$less = WPLessPlugin::getInstance();
$less->setVariables(get_option('reduxlessvars'));
}
}
I think the plugin documentation needs to be updated to reflect this. I have a feeling other plugin components (e.g. function registration) might face a similar issue.
The text was updated successfully, but these errors were encountered:
I think we can change the code to instantiate the loader as soon as possible, and keep the same priority for hooks to avoid this "race condition". It would avoid everybody to update their themes.
Hey guys-
Reverting back to loading during plugin initialization would revert the ability to change compilers. I just changed the code to initialize the compiler on demand instead of specifically in the "init" hook or during the plugin initialization. That way, it will remain backwards compatible and also allow for themes to change compilers using the new 'wp_less_compiler' filter.
In the new version of the plugin @fabrizim has set the compiler to initalize at 'init' priority 1, however the documented method for registering variables uses the functions.php file, which is executed BEFORE the 'init' action in the page life-cycle.
This results in the following error:
The solution was to call the variable registration with a hook after the init@1:
I think the plugin documentation needs to be updated to reflect this. I have a feeling other plugin components (e.g. function registration) might face a similar issue.
The text was updated successfully, but these errors were encountered: