3

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,...

2 Answers 2

2

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...

1
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.

1
  • Unfortunately that plugin is not maintained anymore, and can not be activated. It throws some error during activation. May 28, 2019 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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