Skip to content

Commit f117668

Browse files
committed
Fix BuddyPress hook registration timing
Move BuddyPress hook registration outside of plugin_init() to ensure it's registered before bp_include fires. BuddyPress fires bp_include on plugins_loaded:8, so registering it in plugin_init() (which runs at plugins_loaded:10) would be too late.
1 parent a9b5d24 commit f117668

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

integration/load.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,6 @@ function plugin_init() {
2626
Akismet::init();
2727
}
2828

29-
/**
30-
* Adds BuddyPress support.
31-
*
32-
* This class handles the compatibility with BuddyPress.
33-
* Hooks into bp_include to ensure BuddyPress is fully loaded.
34-
*
35-
* @see https://buddypress.org/
36-
*/
37-
\add_action( 'bp_include', array( __NAMESPACE__ . '\Buddypress', 'init' ), 0 );
38-
3929
/**
4030
* Adds Classic Editor support.
4131
*
@@ -205,3 +195,12 @@ function ( $transformer, $data, $object_class ) {
205195
// Register activation and deactivation hooks for LiteSpeed Cache integration.
206196
\register_activation_hook( ACTIVITYPUB_PLUGIN_FILE, array( __NAMESPACE__ . '\LiteSpeed_Cache', 'add_htaccess_rules' ) );
207197
\register_deactivation_hook( ACTIVITYPUB_PLUGIN_FILE, array( __NAMESPACE__ . '\LiteSpeed_Cache', 'remove_htaccess_rules' ) );
198+
199+
/**
200+
* Load the BuddyPress integration.
201+
*
202+
* Only load code that needs BuddyPress to run once BP is loaded and initialized.
203+
*
204+
* @see https://buddypress.org/
205+
*/
206+
\add_action( 'bp_include', array( __NAMESPACE__ . '\Buddypress', 'init' ), 0 );

0 commit comments

Comments
 (0)