Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to use bp_init and bp_setup_globals at the same time ?


  • calvin_42
    Participant

    @calvin_42

    Hi there.

    I have a small issue : I am using different action hooks like [strong]bp_setup_globals[/strong] or [strong]groups_setup_globals[/strong] in a file my-plugin-bp-functions.php and it works perfectly

    add_action( 'bp_setup_globals', 'my_function' );

    But I want to make my plugin aware of BuddyPress using the recommended code :

    /* Only load the BuddyPress plugin functions if BuddyPress is loaded and initialized. */
    function my_plugin_init() {
    require( dirname( __FILE__ ) . '/my-plugin-bp-functions.php' );
    }
    add_action( 'bp_init', 'my_plugin_init' );

    Problem : my_function isn’t called anymore and it’s pretty logic : bp_init is called after bp_setup_globals has been called.

    So how to use bp_init to load my plugin and still using my hook functions ?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to use bp_init and bp_setup_globals at the same time ?’ is closed to new replies.
Skip to toolbar