bp_get_admin_url

Return the correct admin URL based on BuddyPress and WordPress configuration.

Description

(string) bp_get_admin_url( (string) $path = '', (string) $scheme = 'admin' ); 

Returns (string)

Admin url link with optional path appended.

Parameters (2)

0. $path — Optional. (string) => ''
The sub-path under /wp-admin to be appended to the admin URL.
1. $scheme — Optional. (string) => 'admin'
The scheme.

Usage

  1. if ( !function_exists( 'bp_get_admin_url' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-functions.php'; 
  3.  
  4. // Optional. The sub-path under /wp-admin to be 
  5. // appended to the admin URL. 
  6. $path = ''; 
  7.  
  8. // The scheme. 
  9. $scheme = 'admin'; 
  10.  
  11. // NOTICE! Understand what this does before running. 
  12. $result = bp_get_admin_url($path, $scheme); 
  13.  

Defined (1)

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

/bp-core/bp-core-functions.php  
  1. function bp_get_admin_url( $path = '', $scheme = 'admin' ) { 
  2.  
  3. // Links belong in network admin. 
  4. $url = network_admin_url( $path, $scheme ); 
  5.  
  6. // Links belong in site admin. 
  7. } else { 
  8. $url = admin_url( $path, $scheme ); 
  9.  
  10. return $url;