WP REST API Setup
(function($){
const {root, versionString, nonce} = wpApiSettings
$.ajaxSetup({headers:{"X-WP-Nonce":nonce}})
$.get(`${root}${versionString}users/me`)
.then(userData => {
console.log(userData)
}, error => {
console.warn(error)
})
/* Example customization of user description */
$.post(`${root}${versionString}users/me`, {
meta: {
"wpseo_title": "Rocking with the REST API"
}
})
.then(userData => {
console.log(userData)
}, error => {
console.warn(error)
})
})(jQuery);