@denra
It only happens when I’m trying to run a command via wp-cli (e.g., /usr/local/bin/wp cron event run --due-now
) – this plugin will throw a Fatal Error because $denra_plugins is empty. It works fine otherwise.
Researching, it looks like this is because wp-cli commands are loaded through a function and you need to be explicit in your global
definitions. See here:
https://github.com/wp-cli/wp-cli/issues/2200
WP-CLI now loads WordPress inside of a function: #2089
Global variables need to be explicitly globalized in order to function as expected in WP-CLI.
So yeah, just adding the global $denra_plugins like in my Gist above should solve the wp-cli issue. I was trying to figure out why my cron jobs weren’t running!