bp_core_admin_hook

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

Description

(string) bp_core_admin_hook(); 

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:

Returns (string)

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


Usage

  1. if ( !function_exists( 'bp_core_admin_hook' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_core_admin_hook(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-core/bp-core-functions.php  
  1. function bp_core_admin_hook() { 
  2. $hook = bp_core_do_network_admin() ? 'network_admin_menu' : 'admin_menu'; 
  3.  
  4. /** 
  5. * Filters the action name that BuddyPress nav setup callbacks should be hooked to. 
  6. * @since 1.5.0 
  7. * @param string $hook Action name to be attached to. 
  8. */ 
  9. return apply_filters( 'bp_core_admin_hook', $hook );