Ticket #43266: 43266.2.patch
File 43266.2.patch, 1.5 KB (added by , 7 years ago) |
---|
-
src/wp-includes/js/wp-api.js
848 848 model.unset( 'slug' ); 849 849 } 850 850 851 if ( _.isFunction( model.nonce ) && ! _.is Undefined( model.nonce() ) && ! _.isNull( model.nonce() ) ) {851 if ( _.isFunction( model.nonce ) && ! _.isEmpty( model.nonce() ) ) { 852 852 beforeSend = options.beforeSend; 853 853 854 854 // @todo enable option for jsonp endpoints … … 1466 1466 * Initialize the wp-api, optionally passing the API root. 1467 1467 * 1468 1468 * @param {object} [args] 1469 * @param {string} [args.nonce] The nonce. Optional, defaults to wpApiSettings.nonce. 1469 1470 * @param {string} [args.apiRoot] The api root. Optional, defaults to wpApiSettings.root. 1470 1471 * @param {string} [args.versionString] The version string. Optional, defaults to wpApiSettings.root. 1471 1472 * @param {object} [args.schema] The schema. Optional, will be fetched from API if not provided. … … 1474 1475 var endpoint, attributes = {}, deferred, promise; 1475 1476 1476 1477 args = args || {}; 1477 attributes.nonce = args.nonce || wpApiSettings.nonce || '';1478 attributes.nonce = _.isString( args.nonce ) ? args.nonce : ( wpApiSettings.nonce || '' ); 1478 1479 attributes.apiRoot = args.apiRoot || wpApiSettings.root || '/wp-json'; 1479 1480 attributes.versionString = args.versionString || wpApiSettings.versionString || 'wp/v2/'; 1480 1481 attributes.schema = args.schema || null;