Below is my plugin.php file that would install into wp-content
<?php // If this file is called directly, abort.
namespace Booker;
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Currently plugin version.
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define( 'PLUGIN_NAME_VERSION', '1.0.0' );
/**
* The code that runs during plugin activation.
* This action is documented in includes/class-booker-activator.php
*/
function activate_booker() {
require_once plugin_dir_path(__FILE__) . 'includes/class-booker-activator.php';
error_log("Running Activation");
Booker_Activator::activate();
}
/**
* The code that runs during plugin deactivation.
* This action is documented in includes/class-booker-deactivator.php
*/
function deactivate_booker() {
require_once plugin_dir_path(__FILE__) . 'includes/class-booker-deactivator.php';
error_log("Running Deactivation");
Booker_Deactivator::deactivate();
}
register_activation_hook( __FILE__, 'activate_booker');
register_deactivation_hook( __FILE__, 'deactivate_booker');
?>
It certainly is not executing but the plugin deactivates and activates as expected. Currently, there is no code in the function calls defined inside those functions....but the lack of the log message shows no execution. However, I am getting the problem:
The plugin generated 2368 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.
And in my logs I get:
[08-Oct-2019 23:51:20 UTC] PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'activate_booker' not found or invalid function name in G:\wamp64\www\wordpress\wp-includes\class-wp-hook.php on line 286
[08-Oct-2019 23:51:20 UTC] PHP Stack trace:
[08-Oct-2019 23:51:20 UTC] PHP 1. {main}() G:\wamp64\www\wordpress\wp-admin\plugins.php:0
[08-Oct-2019 23:51:20 UTC] PHP 2. activate_plugin() G:\wamp64\www\wordpress\wp-admin\plugins.php:44
[08-Oct-2019 23:51:20 UTC] PHP 3. do_action() G:\wamp64\www\wordpress\wp-admin\includes\plugin.php:672
[08-Oct-2019 23:51:20 UTC] PHP 4. WP_Hook->do_action() G:\wamp64\www\wordpress\wp-includes\plugin.php:465
[08-Oct-2019 23:51:20 UTC] PHP 5. WP_Hook->apply_filters() G:\wamp64\www\wordpress\wp-includes\class-wp-hook.php:310
And also
[09-Oct-2019 00:44:43 UTC] PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'deactivate_booker' not found or invalid function name in G:\wamp64\www\wordpress\wp-includes\class-wp-hook.php on line 286
[09-Oct-2019 00:44:43 UTC] PHP Stack trace:
[09-Oct-2019 00:44:43 UTC] PHP 1. {main}() G:\wamp64\www\wordpress\wp-admin\plugins.php:0
[09-Oct-2019 00:44:43 UTC] PHP 2. deactivate_plugins($plugins = *uninitialized*, $silent = *uninitialized*, $network_wide = *uninitialized*) G:\wamp64\www\wordpress\wp-admin\plugins.php:192
[09-Oct-2019 00:44:43 UTC] PHP 3. do_action($tag = *uninitialized*, $arg = *uninitialized*) G:\wamp64\www\wordpress\wp-admin\includes\plugin.php:792
[09-Oct-2019 00:44:43 UTC] PHP 4. WP_Hook->do_action($args = *uninitialized*) G:\wamp64\www\wordpress\wp-includes\plugin.php:465
[09-Oct-2019 00:44:43 UTC] PHP 5. WP_Hook->apply_filters($value = *uninitialized*, $args = *uninitialized*) G:\wamp64\www\wordpress\wp-includes\class-wp-hook.php:310
Additional error when I changed the function names:
[09-Oct-2019 02:08:03 UTC] PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'booker_deactivate' not found or invalid function name in G:\wamp64\www\wordpress\wp-includes\class-wp-hook.php on line 286
[09-Oct-2019 02:08:03 UTC] PHP Stack trace:
[09-Oct-2019 02:08:03 UTC] PHP 1. {main}() G:\wamp64\www\wordpress\wp-admin\plugins.php:0
[09-Oct-2019 02:08:03 UTC] PHP 2. deactivate_plugins() G:\wamp64\www\wordpress\wp-admin\plugins.php:192
[09-Oct-2019 02:08:03 UTC] PHP 3. do_action() G:\wamp64\www\wordpress\wp-admin\includes\plugin.php:792
[09-Oct-2019 02:08:03 UTC] PHP 4. WP_Hook->do_action() G:\wamp64\www\wordpress\wp-includes\plugin.php:465
[09-Oct-2019 02:08:03 UTC] PHP 5. WP_Hook->apply_filters() G:\wamp64\www\wordpress\wp-includes\class-wp-hook.php:310