The error message in your question appears to have been thrown from WP CLI. Based on your other comments the problem is that your theme is not properly declaring a global variable.
Somewhere in your code you have this declared outside a function:
$atp_theme = new ATP_theme();
Then in other parts of your code you have:
global $atp_theme;
When using WordPress via the browser, variables declared outside a function, like $atp_theme
in that first line, are global. So you can access them by using global
, like in the second line.
The problem is that when using WP CLI, variables declared outside a function are not automatically global. Therefore global $atp_theme
is undefined.
To solve this you need to explicitly declare the variable as global when defining it, like this:
global $atp_theme;
$atp_theme = new ATP_theme();
Or this would also work:
$GLOBALS['atp_theme'] = new ATP_theme();