WordPress.org

Make WordPress Core

Ticket #27632: registration-url-redirect.27632.diff

File registration-url-redirect.27632.diff, 1.0 KB (added by sanchothefat, 5 years ago)

Patch adds redirect parameter to wp_registration_url

  • src/wp-includes/general-template.php

    diff --git src/wp-includes/general-template.php src/wp-includes/general-template.php
    index f554e1f..13a0a44 100644
    function wp_login_url($redirect = '', $force_reauth = false) { 
    358358 *
    359359 * @since 3.6.0
    360360 *
     361 * @param  string $redirect Path to redirect on register.
    361362 * @return string User registration URL.
    362363 */
    363 function wp_registration_url() {
     364function wp_registration_url( $redirect = '' ) {
     365        $register_url = site_url( 'wp-login.php?action=register', 'login' );
     366
     367        if ( ! empty( $redirect ) ) {
     368                $register_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $register_url );
     369        }
     370
    364371        /**
    365372         * Filter the user registration URL.
    366373         *
    function wp_registration_url() { 
    368375         *
    369376         * @param string $register The user registration URL.
    370377         */
    371         return apply_filters( 'register_url', site_url( 'wp-login.php?action=register', 'login' ) );
     378        return apply_filters( 'register_url', $register_url, $redirect );
    372379}
    373380
    374381/**