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]
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
Post a Comment