WordPress.org

Make WordPress Core

Changeset 18130


Ignore:
Timestamp:
06/03/2011 06:23:41 PM (7 years ago)
Author:
ryan
Message:

Properly return referrer when referer = true and echo = false. Props scribu, webduo. fixes #11953

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r18091 r18130  
    19551955 * important to use nonce field in forms.
    19561956 *
    1957  * If you set $echo to true and set $referer to true, then you will need to
    1958  * retrieve the {@link wp_referer_field() wp referer field}. If you have the
    1959  * $referer set to true and are echoing the nonce field, it will also echo the
    1960  * referer field.
    1961  *
    19621957 * The $action and $name are optional, but if you want to have better security,
    19631958 * it is strongly suggested to set those two parameters. It is easier to just
     
    19831978    $name = esc_attr( $name );
    19841979    $nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
     1980
     1981    if ( $referer )
     1982        $nonce_field .= wp_referer_field( false );
     1983
    19851984    if ( $echo )
    19861985        echo $nonce_field;
    1987 
    1988     if ( $referer )
    1989         wp_referer_field( $echo );
    19901986
    19911987    return $nonce_field;
Note: See TracChangeset for help on using the changeset viewer.