2

I can't find the answer after searching, so...

How do I get the title of a site using the REST API v2? All I can find in the API docs are the posts, pages, tags,...

1

You can get it easily by making a GET request to: http://yourdomain.com/wp-json/. You will see your site name, description, url and home...

| improve this answer | |
0

I recommend WP REST JMESPath for fields filtering and other output modifications.

Example: /wp-json/wp/v2/pages?_query=[0:2].{id: id, title: title.rendered} means get last two pages; get id field; transform title.rendered --> title

Kilo bytes not problem for nowadays internet, but such JSON filtering can be applied to other rest queries.

Also, such filtered response can be passed directly to React component as props without messing existing component props.

| improve this answer | |
  • Unfortunately that plugin is not maintained anymore, and can not be activated. It throws some error during activation. – David Votrubec May 28 '19 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.