=== REST API - Head Tags of SEO Plugins === Contributors: poliuk, luisherranz, rmartinezduque, orballo, davidarenas, santosguillamot, frontity Tags: seo, wp rest api, yoast, meta tags, head Requires at least: 4.7 Tested up to: 5.3.2 Stable tag: trunk Requires PHP: 5.6 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl.html Adds all the meta tags of the head section to WordPress REST API responses, including the ones generated by SEO plugins like Yoast or All in One SEO. == Description == This plugin adds all the tags in the section of a website to WordPress REST API responses. It is perfect if you are using WordPress for a headless set-up and and would like to add the **meta tags** generated by your **WordPress SEO plugin** (like Yoast SEO or All-in-One SEO Pack) to the WordPress REST API output. #### Compatibility This plugin is compatible and works out of the box with most popular WordPress SEO plugins. These are the ones that we have tested: * **Yoast SEO** * **All in One SEO Pack** Are you using a different SEO plugin and want to know if it's compatible? Feel free to ask in our [community forum](https://community.frontity.org/?utm_source=plugin-repository&utm_medium=readme&utm_campaign=rest-api-head-tags-plugin). If you tested any other plugin, please let us know as well so we can update the list. == How to use this plugin == #### Entities with head tags The plugin has been developed to include the head_tags field to the REST API response of most of the WordPress core entities: * Posts, pages, attachments and custom post types. * Post types: for archive pages. * Categories, tags and custom taxonomies. * Authors. #### In a Frontity project In this case, you just have to install the [@frontity/head-tags package](https://docs.frontity.org/api-reference-1/frontity-head-tags?utm_source=plugin-repository&utm_medium=readme&utm_campaign=rest-api-head-tags-plugin) and **it'll work automatically**. #### In a different project You need to understand better how it works and **add the data manually**. ***How to fetch the head_tags field manually*** You have to get each entity from its respective REST API endpoint. For example, for fetching the posts you should go to `/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. In the case of the homepage, it could be less intuitive and you should go to `/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](https://developer.wordpress.org/rest-api/reference/) for more info. Inside each endpoint, it will be a new field named *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. For example for these HTML tags: ` Hello wordl! - My Site ` This would be the content of the head_tags field: ` "head_tags": [ { "tag": "title", "content": "Hello world! - My Site" }, { "tag": "meta", "attributes": { "name": "robots", "content": "max-snippet:-1, max-image-preview:large, max-video-preview:-1" } }, { "tag": "link", "attributes": { "rel": "canonical", "href": "" } } ] ` == Settings == The settings of this plugin are really simple. #### Purge cache In order to not affect the performance of your web, the head_tags field is cached for all your responses, but we've added a button to purge this cache in case something changes. #### Enable output By default, the 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. For example, with the output disabled, `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. == Problems and Questions == If you have any trouble with the REST API - Head Tags, you can check out [our docs](https://docs.frontity.org/frontity-plugins/rest-api-head-tags?utm_source=plugin-repository&utm_medium=readme&utm_campaign=rest-api-head-tags-plugin) or join our [community forum](https://community.frontity.org/?utm_source=plugin-repository&utm_medium=readme&utm_campaign=rest-api-head-tags-plugin) and let us know, we’ll be happy to help! Bug reports for REST API - Head Tags plugin are welcomed in [our repository](https://github.com/frontity/wp-plugins) on GitHub. Before opening an issue, please be sure to review the [contributing guidelines](https://github.com/frontity/frontity/blob/dev/CONTRIBUTING.md). == More Information == [Guide on SEO for Headless WordPress Themes](https://blog.frontity.org/seo-for-headless-wordpress-themes/?utm_source=plugin-repository&utm_medium=readme&utm_campaign=rest-api-head-tags-plugin) [About Frontity Framework](https://docs.frontity.org/#what-is-frontity?utm_source=plugin-repository&utm_medium=readme&utm_campaign=rest-api-head-tags-plugin) Follow Frontity on [Twitter](https://twitter.com/frontity) and [GitHub](https://github.com/frontity/frontity) Get help on the [Frontity Community Forum](https://community.frontity.org/?utm_source=plugin-repository&utm_medium=readme&utm_campaign=rest-api-head-tags-plugin) == Installation == 1. First of all you have to install the plugin. You can do it: * **Automatic**: from within WordPress dashboard go to Plugins, click Add New button, search for REST API - Head Tags of SEO Plugins (by Frontity) and click Install Now. * **Manual**: this method requires to download the plugin and upload it to your web server via FTP. For a more detailed explanation, WordPress explains how to do this [on this guide](https://wordpress.org/support/article/managing-plugins/#manual-plugin-installation). 2. Once installed, you have to activate it and it will be running! The *head_tags* field is cached and enabled by default, but you can purge the cache or disable the output as explained on the [Settings](https://docs.frontity.org/frontity-plugins/rest-api-head-tags#settings?utm_source=plugin-repository&utm_medium=readme&utm_campaign=rest-api-head-tags-plugin) section. == Screenshots == 1. REST API Head Tags of SEO Plugins Settings 2. WordPress REST API response example == Frequently Asked Questions == = Can I just use the plugin in a Frontity project? = No, you can use it for every project. However, if you use Frontity, you can get all the data automatically with this [Frontity package](https://docs.frontity.orgapi-reference-1/frontity-head-tags?utm_source=plugin-repository&utm_medium=readme&utm_campaign=rest-api-head-tags-plugin). On the other hand, if you are not using Frontity, you have to add the data manually as explained at the [plugin docs](https://docs.frontity.org/frontity-plugins/rest-api-head-tags#in-a-different-project). = I have installed and activated the plugin, where can I find the tags? = You can find the head tags exposed in the WordPress REST API after making an API request. You can find a new field named `head_tags` which is an array of all the meta tags, just as they appear in the web page section. You can see more information at the [plugin docs](https://docs.frontity.org/frontity-plugins/rest-api-head-tags#in-a-different-project?utm_source=plugin-repository&utm_medium=readme&utm_campaign=rest-api-head-tags-plugin). = Where can I find the head tags of the homepage? = If you are not using [Frontity package](https://docs.frontity.org/api-reference-1/frontity-head-tags?utm_source=plugin-repository&utm_medium=readme&utm_campaign=rest-api-head-tags-plugin), that will automatically do it, you should fetch this data at `/wp-json/wp/v2/types/post` endpoint. = Will the plugin add the meta tags to my custom post types and custom taxonomies? = Yes, the plugin will automatically add the meta tags to the custom post types and custom taxonomies. You can check which entities show the new field at [its docs](https://docs.frontity.org/frontity-plugins/rest-api-head-tags#entities-with-head-tags?utm_source=plugin-repository&utm_medium=readme&utm_campaign=rest-api-head-tags-plugin). = Is this plugin compatible with Yoast SEO plugin? And with All in One SEO? = Yes! It is compatible out of the box with most of the SEO plugins, and Yoast SEO and All in One SEO plugins have already been tested. == Changelog ==