-
Couldn't load subscription status.
- Fork 88
Description
Describe the bug
EE_Front_Controller::get_request() runs on parse_request priority 1 and for whatever reason removes itself during its execution. If another plugin adds an action on the parse_request hook with a priority 0, when EE_Front_Controller::get_request() removes itself it causes WordPress to skip the actions registered on priority 10.
To Reproduce
On a vanilla WordPress installation with no plugins activated:
- Set
WP_DEBUGtotrueandWP_DEBUG_LOGtotrue - Add the following code snippet to an MU Plugin (or similar):
add_action( 'parse_request', function($wp) {
error_log( 'This will be logged...' );
}, 0 );
add_action( 'parse_request', function($wp) {
error_log( 'This will be skipped when Event Espresso is activated...' );
}, 10 );
- Load the homepage and then review
/wp-content/debug.logto verify both messages are logged - Activated Event Espresso
- Load the homepage and check the log again. Only the first message is logged; the second has been skipped
A real-world example of this bug can be seen if you install the LifterLMS plugin alongside Event Espresso. It registers on priority 0 of parse_request and triggers the bug.
Expected behavior
All registered hooks on parse_request should execute. Could the remove_action() line be removed? If it's important to unhook this code, perhaps it could be delayed until after parse_request completes, or on a very late priority 9999?
Environment:
- Version of Event Espresso: 5.0.37.decaf and 5.0.45
- Version of WordPress: 6.8.2
- Browser: any
- PHP Version 8.1, 8.4