Make WordPress Core


Ignore:
Timestamp:
03/20/2019 08:52:08 PM (6 years ago)
Author:
aduth
Message:

Scripts: Assign api-fetch nonce with corrected rest_nonce.

As of @wordpress/api-fetch@3.0.0 (introduced in 44812), the apiFetch nonce middleware must have its nonce value assigned explicitly, and will no longer listen for heartbeat ticks automatically. This changeset adds an inline script for the default registration of the api-fetch script handle to assign the nonce value in response to the heartbeat action. In doing so, it removes the now-unused, misnamed rest-nonce property from the heartbeat response, whose original introduction served as temporary compatibility with earlier versions of @wordpress/api-fetch.

See https://github.com/WordPress/gutenberg/pull/13451
See #45113

Props adamsilverstein, nerrad .
Fixes #46107 .

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/misc.php

    r44788 r44949  
    10831083    // Refresh the Rest API nonce.
    10841084    $response['rest_nonce'] = wp_create_nonce( 'wp_rest' );
    1085     // TEMPORARY: Compat with api-fetch library
    1086     $response['rest-nonce'] = $response['rest_nonce'];
    10871085
    10881086    // Refresh the Heartbeat nonce.
Note: See TracChangeset for help on using the changeset viewer.