Add redirect param to wp_loginout(). Props Denis-de-Bernardy. fixes #9241

git-svn-id: https://develop.svn.wordpress.org/trunk@11101 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-04-27 20:00:59 +00:00
parent 6cced8d299
commit 8f15c79dda
1 changed files with 5 additions and 3 deletions

View File

@ -136,12 +136,14 @@ function get_search_form() {
*
* @since 1.5.0
* @uses apply_filters() Calls 'loginout' hook on HTML link content.
*
* @param string $redirect Optional path to redirect to on login/logout.
*/
function wp_loginout() {
function wp_loginout($redirect = '') {
if ( ! is_user_logged_in() )
$link = '<a href="' . wp_login_url() . '">' . __('Log in') . '</a>';
$link = '<a href="' . clean_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>';
else
$link = '<a href="' . wp_logout_url() . '">' . __('Log out') . '</a>';
$link = '<a href="' . clean_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>';
echo apply_filters('loginout', $link);
}