Ticket #43265: 43265.patch
File 43265.patch, 1.4 KB (added by , 7 years ago) |
---|
-
src/wp-includes/js/wp-api.js
993 993 options = options || {}; 994 994 beforeSend = options.beforeSend; 995 995 996 // If we have a localized nonce, pass that along with each sync. 997 if ( 'undefined' !== typeof wpApiSettings.nonce ) { 996 if ( _.isFunction( model.nonce ) && ! _.isUndefined( model.nonce() ) && ! _.isNull( model.nonce() ) ) { 998 997 options.beforeSend = function( xhr ) { 999 xhr.setRequestHeader( 'X-WP-Nonce', wpApiSettings.nonce);998 xhr.setRequestHeader( 'X-WP-Nonce', model.nonce() ); 1000 999 1001 1000 if ( beforeSend ) { 1002 1001 return beforeSend.apply( self, arguments ); … … 1405 1404 return new loadingObjects.models[ modelClassName ]( attrs, options ); 1406 1405 }, 1407 1406 1407 // Track nonces at the Endpoint level. 1408 nonce: function() { 1409 return routeModel.get( 'nonce' ); 1410 }, 1411 1408 1412 // Include a reference to the original class name. 1409 1413 name: collectionClassName, 1410 1414 … … 1432 1436 return new loadingObjects.models[ modelClassName ]( attrs, options ); 1433 1437 }, 1434 1438 1439 // Track nonces at the Endpoint level. 1440 nonce: function() { 1441 return routeModel.get( 'nonce' ); 1442 }, 1443 1435 1444 // Include a reference to the original class name. 1436 1445 name: collectionClassName, 1437 1446