wordpress - How to get site's name from WP API -


i'm trying wordpress website title using javascript , wp api plugin

i didn't find example on how site's name found variable name under entities section in developer guide

function _updatetitle(documenttitle) {     document.queryselector('title').innerhtml =          documenttitle + ' | '+ $http.get('wp-json/name'); } 

the output string of $http.get('wp-json/name') [object object]

output

does know how use fix this?

you didn't enough context. what's $http? happens when go wp-json/name directly in browser? here's see:

[{   "code":"json_no_route",   "message":"no route found matching url , request method" }] 

here's simple example title:

var sitename; $.getjson( "/wp-json", function( data ) {   sitename = data.name; }); 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -