Make WordPress Core

Changeset 37753


Ignore:
Timestamp:
06/20/2016 08:47:20 AM (8 years ago)
Author:
DrewAPicture
Message:

Docs: Clarify documentation for wp_logout_url() and wp_login_url() and corresponding hooks to highlight whether HTML-encoded or un-encoded values should be expected.

The return from wp_logout_url() is HTML-encoded due to its value passing through wp_nonce_url() and thus esc_html(). Adversely wp_login_url() passes through no such escaping and therefore should not be expected to return an HTML-encoded value.

Props akibjorklund for the initial patch.
Fixes #34352.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r37738 r37753  
    290290
    291291/**
    292  * Returns the Log Out URL.
     292 * Retrieves the logout URL.
    293293 *
    294294 * Returns the URL that allows the user to log out of the site.
     
    297297 *
    298298 * @param string $redirect Path to redirect to on logout.
    299  * @return string A log out URL.
     299 * @return string The logout URL. Note: HTML-encoded via esc_html() in wp_nonce_url().
    300300 */
    301301function wp_logout_url($redirect = '') {
     
    313313     * @since 2.8.0
    314314     *
    315      * @param string $logout_url The Log Out URL.
     315     * @param string $logout_url The HTML-encoded logout URL.
    316316     * @param string $redirect   Path to redirect to on logout.
    317317     */
     
    320320
    321321/**
    322  * Returns the URL that allows the user to log in to the site.
     322 * Retrieves the login URL.
    323323 *
    324324 * @since 2.7.0
    325325 *
    326  * @param string $redirect     Path to redirect to on login.
    327  * @param bool   $force_reauth Whether to force reauthorization, even if a cookie is present. Default is false.
    328  * @return string A log in URL.
     326 * @param string $redirect     Path to redirect to on log in.
     327 * @param bool   $force_reauth Whether to force reauthorization, even if a cookie is present.
     328 *                             Default false.
     329 * @return string The login URL. Not HTML-encoded.
    329330 */
    330331function wp_login_url($redirect = '', $force_reauth = false) {
     
    343344     * @since 4.2.0 The `$force_reauth` parameter was added.
    344345     *
    345      * @param string $login_url    The login URL.
     346     * @param string $login_url    The login URL. Not HTML-encoded.
    346347     * @param string $redirect     The path to redirect to on login, if supplied.
    347348     * @param bool   $force_reauth Whether to force reauthorization, even if a cookie is present.
Note: See TracChangeset for help on using the changeset viewer.