Reference › Functions wp_logout_url ( string $redirect = '' ): string
Since 2.7.0
Source wp-includes/general-template.php:416Description Parameters Return Hooks fired Uses Used by Source History Retrieves the logout URL.
Description Returns the URL that allows the user to log out of the site.
Parameters
$redirectstring optional Path to redirect to on logout.Default: '' Return
string The logout URL. Note: HTML-encoded via esc_html() in wp_nonce_url(). Hooks fired · 1 One hook fires while wp_logout_url() runs, in this order:
1 Uses · 4 add_query_arg() Retrieves a modified URL query string. site_url() Retrieves the URL for the current site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible. wp_nonce_url() Retrieves URL with nonce added to URL query. apply_filters() Calls the callback functions that have been added to a filter hook. Source View on Trac ↗ View on GitHub ↗
416 function wp_logout_url ( $redirect = '' ) { 417 $args = array ( ) ; 418 if ( ! empty ( $redirect ) ) { 419 $args [ 'redirect_to' ] = urlencode ( $redirect ) ; 420 } 421 422 $logout_url = add_query_arg ( $args , site_url ( 'wp-login.php?action=logout' , 'login' ) ) ; 423 $logout_url = wp_nonce_url ( $logout_url , 'log-out' ) ; 424 425 426 * Filters the logout URL. 427 * 428 * @since 2.8.0 429 * 430 * @param string $logout_url The HTML-encoded logout URL. 431 * @param string $redirect Path to redirect to on logout. 432 */ 433 return apply_filters ( 'logout_url' , $logout_url , $redirect ) ; 434 } History Introduced in 2.7.0 . Unchanged from 6.7.7 through 7.1.0.
6.7.7 6.8.8 6.9.7 7.0.4 7.1.0 Signature, return type and hooks compared across 5 parsed releases.
About this page Parsed data Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/general-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. Corrections Something wrong on this page? Report it and it gets fixed in the next regeneration.