TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins). It allows your users to install, update and even automatically activate plugins in singular or bulk fashion using native WordPress classes, functions and interfaces. You can reference bundled plugins, plugins from the WordPress Plugin Repository or even plugins hosted elsewhere on the internet.
This is an edge case but when using frameworks such as Themosis or Bedrock, these work by loading up dependancies at root level before Wordpress is instantiated, along with any composer autoload files - so functions like did_action in your autoload file do not exist yet, and throw a fatal error.
The way these frameworks work is to load up instantiation of dependant functions and processes through ServiceProviders on boot, and it here that we would call load_tgm_plugin_activation, and not in the composer autoload.
See below ServiceProvider we are using for TGMPA integration with our framework which works nicely when this pull request is applied:
This is an edge case but when using frameworks such as Themosis or Bedrock, these work by loading up dependancies at root level before Wordpress is instantiated, along with any composer autoload files - so functions like
did_action
in your autoload file do not exist yet, and throw a fatal error.The way these frameworks work is to load up instantiation of dependant functions and processes through
ServiceProviders
onboot
, and it here that we would callload_tgm_plugin_activation
, and not in the composer autoload.See below ServiceProvider we are using for TGMPA integration with our framework which works nicely when this pull request is applied:
https://github.com/wp-kit/tgmpa-integration/blob/master/src/Tgmpa/TgmpaServiceProvider.php#L22