CalderaWP/seo-rest-api-fields

Name: seo-rest-api-fields

Owner: Caldera Labs

Description: BETA Adds SEO fields to the WordPres REST API response, and allows editing via the API.

Created: 2015-07-20 22:48:20.0

Updated: 2017-09-15 11:14:31.0

Pushed: 2015-07-26 01:48:03.0

Homepage:

Size: 136

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

REST API SEO Fields

Adds SEO Fields from WordPress SEO by Yoast to responses for posts in the WordPress REST API 2.0-beta3. Also allows for updating by an authenticated user.

This plugin is a free plugin by CalderaWP. It is not an official add-on for WordPress SEO and is no way associated with the makers of WordPress SEO.

Other SEO Plugins?

Right now this only works with WordPress SEO by Yoast. It could work with other plugins. Just create a new instance of the main class, and pass the title and description meta fields it uses.

if ( defined( 'REST_API_VERSION' ) && version_compare( REST_API_VERSION,'2.0-beta3', '>=' ) ) {
    //update these variables!!!
    $title_field = 'your_title_field';
    $description_field = 'your_description_field';
    new CWP_REST_API_SEO_Fields( $title_field, $description_field );
    }

}

The above should be performed at the rest_api_init action.

License & Copyright

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.