WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/02/2017 04:44:05 PM (4 years ago)
Author:
jnylen0
Message:

REST API: Allow overriding jQuery.ajax calls from within wp-admin

There are now 3 places where we call out to the REST API from within wp-admin. This commit introduces a small library to allow overriding these calls, centralize nonce-passing logic, and eliminate the need to pass a full REST URL down to client code (this last feature is not yet used and will be explored in a separate ticket).

Fixes #40919.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/qunit/index.html

    r40784 r41206  
    2020        <script>
    2121            var wpApiSettings = {
    22                 'root': 'http://localhost/wp-json/'
     22                root: 'http://localhost/wp-json/',
     23                nonce: 'not_a_real_nonce'
    2324            };
    2425        </script>
     
    7879        <script src="../../src/wp-includes/js/shortcode.js"></script>
    7980        <script src="../../src/wp-admin/js/customize-controls.js"></script>
     81        <script src="../../src/wp-includes/js/api-request.js"></script>
    8082        <script src="../../src/wp-includes/js/wp-api.js"></script>
    8183
     
    123125        <script src="wp-admin/js/customize-header.js"></script>
    124126        <script src="wp-includes/js/shortcode.js"></script>
     127        <script src="wp-includes/js/api-request.js"></script>
    125128        <script src="wp-includes/js/wp-api.js"></script>
    126129        <script src="wp-admin/js/customize-controls.js"></script>
Note: See TracChangeset for help on using the changeset viewer.