This is an extension to the WPGraphQL plugin (https://github.com/wp-graphql/wp-graphql) that returns Yoast SEO data.
Currently returning SEO data for pages, posts, custom post types, categories and custom taxonomies.
Using this plugin? I would love to see what you make with it. @ash_hitchcock
- Install & activate WPGraphQL
- Clone or download the zip of this repository into your WordPress plugin directory & activate the WP GraphQL Yoast SEO plugin
composer require ashhitch/wp-graphql-yoast-seo
To query for the Yoast Data as the seo object to your query:
{
pages(first: 10) {
edges {
node {
id
title
seo {
title
metaDesc
focuskw
metaKeywords
metaRobotsNoindex
metaRobotsNofollow
opengraphTitle
opengraphDescription
opengraphImage {
altText
sourceUrl
srcSet
}
twitterTitle
twitterDescription
twitterImage {
altText
sourceUrl
srcSet
}
}
}
}
}
}
Image urls are now returned as mediaItem
type.
This applies to twitterImage
and opengraphImage
This can be used in production, however it is still under active development.