Skip to content

Commit

Permalink
Feature/woocommerce (#20)
Browse files Browse the repository at this point in the history
* woocommerce product support
  • Loading branch information
ashhitch authored Feb 4, 2020
1 parent 2ee837b commit 58d1ecc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion wp-graphql-yoast-seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author URI: https://www.ashleyhitchcock.com
* Text Domain: wp-graphql-yoast-seo
* Domain Path: /languages
* Version: 3.0.2
* Version: 3.1.0
*
* @package WP_Graphql_YOAST_SEO
*/
Expand All @@ -22,6 +22,12 @@
$post_types = \WPGraphQL::get_allowed_post_types();
$taxonomies = \WPGraphQL::get_allowed_taxonomies();

// If WooCommerce installed then add these post types and taxonomies
if ( class_exists( '\WooCommerce' ) ) {
array_push($post_types, 'product');
array_push($taxonomies, 'productCategory');
}

register_graphql_object_type('SEO', [
'fields' => [
'title' => ['type' => 'String'],
Expand All @@ -39,6 +45,7 @@
]
]);


if (!empty($post_types) && is_array($post_types)) {
foreach ($post_types as $post_type) {
$post_type_object = get_post_type_object($post_type);
Expand Down

0 comments on commit 58d1ecc

Please sign in to comment.