WordPress.org

Make WordPress Core

Ticket #17950: 17950.diff

File 17950.diff, 1.3 KB (added by scribu, 8 years ago)
  • wp-includes/general-template.php

     
    195195}
    196196
    197197/**
     198 * Returns the user registration URL
     199 *
     200 * Returns the URL that allows the user to log in to the site
     201 *
     202 * @since 3.3.0
     203 * @uses site_url() To generate the log in URL
     204 * @uses apply_filters() calls 'register_url' hook on final url
     205 *
     206 * @param string $redirect Path to redirect to on login (optional).
     207 * @return string
     208 */
     209function wp_register_url( $redirect = '' ) {
     210        $register_url = site_url( 'wp-login.php?action=register', 'login' );
     211
     212        if ( !empty( $redirect ) )
     213                $register_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $register_url );
     214
     215        return apply_filters( 'register_url', $register_url, $redirect );
     216}
     217
     218/**
    198219 * Returns the Log Out URL.
    199220 *
    200221 * Returns the URL that allows the user to log out of the site
     
    333354
    334355        if ( ! is_user_logged_in() ) {
    335356                if ( get_option('users_can_register') )
    336                         $link = $before . '<a href="' . site_url('wp-login.php?action=register', 'login') . '">' . __('Register') . '</a>' . $after;
     357                        $link = $before . '<a href="' . wp_register_url() . '">' . __('Register') . '</a>' . $after;
    337358                else
    338359                        $link = '';
    339360        } else {