WordPress REST API with Platinum SEO Meta Data

Platinum SEO is now integrated with the WordPress REST API, an interface that developers can use to build their own frontend Apps or systems using JavaScript frameworks while fetching the content and the related SEO meta data from the WordPress ecosystem, through this API. This lets WordPress to be used as an Headless backend system that provides all the content to interactive Web and mobile APPs built using JavaScript and/or other technologies.

WordPress REST API and Platinum SEO Integration

Platinum SEO is one of the few WordPress SEO plugins that support fetching the SEO meta data using WordPress REST API. It thus supports Headless WordPress applications. There are two ways of fetching the Platinum SEO Meta data using the WordPress REST API..

1) One is through the psp_head field that is included in the normal WP REST API responses for the various built-in Endpoints.
2) The other is through the plugin’s own custom endpoint.

WordPress REST API responses with Platinum SEO meta data

As an example, assume you’re retrieving a Post using any of the following built-in WordPress REST API Endpoints.

https://example.com/wp-json/wp/v2/posts/1
http://example.com/wp-json/wp/v2/posts?slug=hello-world

The Platinum SEO meta data is added as an additional field by name “psp_head” to the normal WP REST API response. This field will have all the necessary meta tags added by Platinum SEO for the Post or Page as HTML. You can similarly receive this meta data through the “psp_head” field for others like posts, pages, categories, tags, custom post types and custom taxonomies.

Similarly, if you have Post Type Archives,, the built-in Types endpoint will include the appropriate Platinum SEO meta data against the psp_head field.

Platinum SEO REST API Endpoint

Platinum SEO REST API Endpoint for any URL on your WordPress Website is something like this

https://example.com/wp-json/platinumseo/v1/get_psp_meta?url=https://example.com/hello-world/

This custom REST API Endpoint currently supports only the GET method.

The Response to this Endpoint will look something like this:

{
"psp_head": "the complete, escaped meta data output from the plugin that is usually added to the section of your Post or Page",
"status": 200,
}

Thus, the Platinum SEO meta data sent as a response for any requested URL will include the following:

  1. Title
  2. Meta description
  3. Robots meta tag
  4. Canonical URL
  5. JSON Schema output, if you have added any through the Platinum SEO Plugin.
  6. Open Graph meta data
  7. Twitter meta data

However, you may choose to disable canonical in Platinum SEO settings, if your Web app is located on another domain. The other alternative is to set up the Canonical as a cross domain canonical to every single Post, Page, Custom Post Type and Taxonomy. This is the best and recommended method.

Platinum SEO and Headless WordPress

WordPress, being an open-source platform, offers flexibility to create any kind of website easily. Using WordPress as a headless CMS, allows you to create the front-end of your web application or mobile application using any technology and manage its content using the WordPress CMS.

By adding support for REST API in Platinum SEO, we hope to make the output of this WordPress SEO Plugin meta data through both the built-in WordPress REST API Endpoints and the plugin’s own REST API endpoint. This would help in building headless WordPress sites. Do let us know your valuable feedback so we can work on this to further improve its usability.

Leave a Reply

Your email address will not be published. Required fields are marked *

*