Instead of this ASCII mess, it should simply be: “Who’s this?”
No, it should not.
If you make a OPTIONS
request to the /wp-json/wp/v2/pages
path, you’ll see the schema which defines all the fields that exist within a Page record, like so for the post title field, via JavaScript’s fetch()
:
Therefore, title.rendered
is meant for display and thus, filters like wptexturize()
( which converts the '
to ’s
) are applied to the raw post title.
-
See
WP_REST_Posts_Controller::prepare_item_for_response()
which usesget_the_title()
which applies the filter hookthe_title
. -
See also
WP_REST_Posts_Controller::get_item_schema()
which defines core post/page record’s fields.
If you want to get the raw post title, you can use /wp/v2/pages?slug=about&context=edit
, i.e. set the context
parameter to edit
, and read the raw title via title.raw
, but authentication is required.
- Alternate options (apart from disabling the texturize filters): filter the schema or modify the REST API response, or create a custom REST field which would return the raw title. But then, it is up to you to decide on the most appropriate option in your case. ✌