Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_safe_redirect [ WordPress Function ]

wp_safe_redirect ( $location, $status = 302 )
Uses:
Returns:
  • (void) Does not return anything
Defined at:



Performs a safe (local) redirect, using wp_redirect().

Checks whether the $location is using an allowed host, if it has an absolute path. A plugin can therefore set or remove allowed host(s) to or from the list.

If the host is not allowed, then the redirect is to wp-admin on the siteurl instead. This prevents malicious redirects which redirect to another host, but only used in a few places.

Source


<?php
function wp_safe_redirect($location$status 302) {

    
// Need to look at the URL the way it will end up in wp_redirect()
    
$location wp_sanitize_redirect($location);

    
$location wp_validate_redirect($locationadmin_url());

    
wp_redirect($location$status);
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics