Hi, I got your email regarding this issue as well, i will reply here so anyone else having a similar issue maybe will find it useful.
Either way, I am not that familiar with WP CLI, but it seems that it is ignoring global variables set in wpadverts.php, specifically in this case variable $adverts_namespace is being ignored it should have a “config” key it is explicitly set in wpadverts/wpadverts.php file.
When i will find some free time i will install WP CLI and check this on my own, in the meantime, you would need to contact WP CLI support, maybe they can shed some light on this, knowing how WPAdverts is using global variables.
Hi Greg, thanks for your feedback.
A bit surprising you haven’t tried WP CLI, you really should give it a go. Globals are always problematic, but I’ll check with them too to see if there’s something that can be done here. They will probably say this should avoid globals. Lets see.
Hi, i will look into both the global variable and WP CLI :), although removing the global variable might be difficult as the addons are using it as well.
@gwin If you explicitly globalize the global (e.g. global $adverts_namespace
), the issue will be fixed.
WP-CLI loads WordPress inside of a function, which means any implicitly global variables are no longer global.
Thanks for feedback, if i understand correctly i need to change in wpadverts/wpadverts.php file lines
// define global $adverts_config variable
$adverts_config = null;
// define global $adverts_namespace variable
$adverts_namespace = array( 'config' => array(
to
// define global $adverts_config variable
global $adverts_config = null;
// define global $adverts_namespace variable
global $adverts_namespace = array( 'config' => array(
If that’s the case i will make such update in next WPAdverts release.
or rather
// define global $adverts_config variable
global $adverts_config;
$adverts_config = null;
// define global $adverts_namespace variable
global $adverts_namespace;
$adverts_namespace = array( 'config' => array(