Tagged: wp-cli
Hi,
I’m using WP-CLI to maintain my websites and I keep getting PHP notices produced by Enfold, which is a bit annoying, cause they obscure the output I’m interested in.
I found out that the problem is caused by false assumption that file enfold/framework/avia_framework.php
will be always included in global scope and thus all variables declared in it will be global. This is not true in case of WP-CLI, because WP-CLI bootstraps WordPress in local scope.
The solution is to declare global variables via $GLOBALS
array. In other words, instead of: $avia = new avia_superobject($avia_base_data);
You should use: $GLOBALS['avia'] = new avia_superobject($avia_base_data);
Alternative solution is to make sure no “actual” code is run directly on inclusion (ie. every functionality is hooked to proper hook). Currently, this is not true for example in case of enfold/includes/admin/register-widget-area.php
as this file is directly included by functions.php
and makes call to avia_get_option
which references global $avia
(which is not always global as explained above).
I would appreciate if you could relate this feedback to your dev team :)
Cheers,
Česlav