wpmu_admin_do_redirect

Redirect a user based on $_GET or $_POST arguments.

Description

wpmu_admin_do_redirect( (string) $url = '' ); 

The function looks for redirect arguments in the following order: 1) $_GET['ref'] 2) $_POST['ref'] 3) $_SERVER['HTTP_REFERER'] 4) $_GET['redirect'] 5) $_POST['redirect'] 6) $url

Parameters (1)

0. $url — Optional. (string) => ''
Redirect URL. Default empty.

Usage

  1. if ( !function_exists( 'wpmu_admin_do_redirect' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-deprecated.php'; 
  3.  
  4. // Optional. Redirect URL. Default empty. 
  5. $url = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpmu_admin_do_redirect($url); 
  9.  

Defined (1)

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

/wp-includes/ms-deprecated.php  
  1. function wpmu_admin_do_redirect( $url = '' ) { 
  2. _deprecated_function( __FUNCTION__, '3.3.0' ); 
  3.  
  4. $ref = ''; 
  5. if ( isset( $_GET['ref'] ) ) 
  6. $ref = $_GET['ref']; 
  7. if ( isset( $_POST['ref'] ) ) 
  8. $ref = $_POST['ref']; 
  9.  
  10. if ( $ref ) { 
  11. wp_redirect( $ref ); 
  12. exit(); 
  13. if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) { 
  14. wp_redirect( $_SERVER['HTTP_REFERER'] ); 
  15. exit(); 
  16.  
  17. if ( isset( $_GET['redirect'] ) ) { 
  18. if ( substr( $_GET['redirect'], 0, 2 ) == 's_' ) 
  19. $url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) ); 
  20. } elseif ( isset( $_POST['redirect'] ) ) { 
  21. $url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] ); 
  22. wp_redirect( $url ); 
  23. exit();