bp_core_admin_hook()

Return the action name that BuddyPress nav setup callbacks should be hooked to.

Description

Functions used to set up BP Dashboard pages (wrapping such admin-panel functions as add_submenu_page()) should use bp_core_admin_hook() for the first parameter in add_action(). BuddyPress will then determine automatically whether to load the panels in the Network Admin. Ie:

add_action( bp_core_admin_hook(), 'myplugin_dashboard_panel_setup' );

Return

(string) $hook The proper hook ('network_admin_menu' or 'admin_menu').

Source

File: bp-core/bp-core-functions.php

1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
function bp_core_admin_hook() {
    $hook = bp_core_do_network_admin() ? 'network_admin_menu' : 'admin_menu';
 
    /**
     * Filters the action name that BuddyPress nav setup callbacks should be hooked to.
     *
     * @since BuddyPress 1.5.0
     *
     * @param string $hook Action name to be attached to.
     */
    return apply_filters( 'bp_core_admin_hook', $hook );
}

Changelog

Changelog
Version Description
BuddyPress 1.5.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.