Skip to content

Commit

Permalink
- update term check in MaxAge.php
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbahl committed Aug 26, 2024
1 parent d5d9865 commit 2ca9004
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Document/MaxAge.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function () {
$config['resolve'] = function ( \WPGraphQL\Model\Post $post, $args, $context, $info ) {
$term = get_the_terms( $post->ID, self::TAXONOMY_NAME );

return isset( $term[0]->name ) ? $term[0]->name : null;
return is_array( $term ) && $term[0] instanceof \WP_Term ? $term[0]->name : null;
};
register_graphql_field( $register_type_name, 'max_age_header', $config );
}
Expand Down

0 comments on commit 2ca9004

Please sign in to comment.