<head>
section of a site to WordPress REST API responses. You can download it here.@frontity/yoast
package instead.head_tags
field to the REST API response of most of the WordPress core entities:@frontity/head-tags
package and it'll work automatically./wp-json/wp/v2/posts&id=123
endpoint, for fetching the categories you have to go to wp-json/wp/v2/categories&id=123,
and for custom post types or custom taxonomies would be a different URL in each case./wp-json/wp/v2/types/post.
As previously said, each entity has a different endpoint so if you aren't familiar with this, you should check the WordPress REST API reference for more info.head_tags
, which will be an array of objects representing the tags that WordPress would normally include inside the HTML head
element. These objects have the properties tag
, attributes
and content
.head_tags
field:head_tags
field is cached for all your responses, but we've added a button to purge this cache in case something changes.head_tags
field is included in the common endpoint of each entity. You can configure it so it doesn't appear by default and to be shown when you include the head_tags=true
query.https://mysite.com/wp-json/wp/v2/posts
won't show the head_tags
field unless you have the query ? head_tags=true
at the end.skip_cache
.skip_cache&head_tags_skip_cache=false
.Add New
button, search for REST API - Head Tags
(by Frontity) and click Install Now
.head_tags
field is cached and enabled by default, but you can purge the cache or disable the output as explained in the Settings section above.wp_head
action.wp_head
action for every entity contained in the REST API response and transform the generated HTML code into a JSON object. That means, any hook registered to that action could be causing the problem if it:head_tags
field (like the menu-items
endpoint).head_tags=false
to the query, as explained in REST API - Head Tags plugin not working with WordPress REST API Menus Endpoints.head_tags
fieldwp_head
. This is not easy to solve, you would have to find what hooks add the missing fields and attach them to wp_head
, or write those hooks yourself.<title>
tag in header.php
directly - without using the wp_head
action. You can take a look at REST API - Head Tags Plugin error with NewsPaper theme for a specific solution if you are using this theme.<head>
. You can try using one that comes with WordPress by default to fix this.head_tags
fieldskip_cache=true
as a parameter in a specific REST API request to regenerate the head_tags
field values that appear in the response.