WP REST Yoast Meta

Descripción

Are you using WordPress for a headless set-up, using the WP REST API? And would you like to use the Yoast SEO plugin just like you would for any other project? This plugin adds the meta tags generated by the Yoast SEO plugin to the WP REST API output, allowing your headless set-up to implement them. Also when you are using Yoast SEO Premium you have the option to retrieve redirects throught the API: this plugin adds a custom endpoint (/wp-rest-yoast-meta/v1/redirects) to provide those redirects in a JSON format.

Installation from within WordPress

  1. Visit ‘Plugins > Add New’ (or ‘My Sites > Network Admin > Plugins > Add New’ if you are on a multisite installation).
  2. Search for ‘WP REST Yoast Meta’.
  3. Activate the WP REST Yoast Meta plugin through the ‘Plugins’ menu in WordPress.

Installation manually

  1. Upload the wp-rest-yoast-meta folder to the /wp-content/plugins/ directory.
  2. Activate the WP REST Yoast Meta plugin through the ‘Plugins’ menu in WordPress.

Capturas de pantalla

  • The WP REST API output for the Hello World post example.

FAQ

I have installed the plugin, where can I find the Yoast meta tags?

For each post/page/… you can find an array of meta tags in that object under yoast_meta.

I have created a custom post type, will the plugin add the meta tags to that post type?

Yes, the plugin will automatically add meta tags to custom post types. Unless you have created a custom WP_REST_Controller for it and have not implemented the rest_prepare_POSTTYPE filter.

Can I add my own meta tags?

Yes you can! Use the hook wp_rest_yoast_meta/filter_yoast_meta like this:

/**
 * Add a custom meta tag.
 */
function wpym_add_custom_meta_tag( $yoast_meta ) {
    $yoast_meta[] = array(
        'property' => 'og:type',
        'content' => 'article'
    );
    return $yoast_meta;
}
add_filter( 'wp_rest_yoast_meta/filter_yoast_meta', 'wpym_add_custom_meta_tag', 10, 1);
I have the Yoast SEO Premium plugin installed, will it work?

Yes this plugin supports both the free and the premium version of Yoast SEO. Please keep in mind that the free version of Yoast SEO does not allow you to specify redirects, so the redirects endpoint will return an empty set.

Opiniones

Leer 1 comentario

Colaboradores & Desarrolladores

“WP REST Yoast Meta” es software de código abierto. Las siguientes personas han contribuido a este plugin.

Colaboradores

Traduce & #8220;WP REST Yoast Meta” a tu idioma.

¿interesado en el desarrollo?

Revisa el código , echa un vistazo al repositorio SVN , o suscríbete al log de desarrollo por RSS .

Historial de cambios

2019.2.1

Release Date: June 27th, 2019

Bugfix: Yoast meta wasn’t regenerated correctly after a post update.

2019.2.0

Release Date: June 16th, 2019

Improvement: Meet WordPress Coding Standards.
Bugfix: Better check if Yoast SEO (Premium) is installed and activated.

2019.1.0

Release Date: March 6th, 2019

First public version.