Remove Default Schema Data | Start Fresh
-
Hey,
I’m trying to create custom schema data for EmployerAggregateReview type, but it’s currently throwing some warnings.
Here’s my code:
add_filter('site-reviews/schema/EmployerAggregateRating', function ($schema) { $post_id = get_the_ID(); $ratingInfo = apply_filters('glsr_get_ratings', null, [ 'assigned_posts' => $post_id, ]); // modify the $schema array here. $schema['ratingValue'] = $ratingInfo->average; $schema['ratingCount'] = $ratingInfo->reviews; $schema['bestRating'] = '5'; $schema['worstRating'] = '1'; $schema['itemReviewed'] = [ '@type' => 'Organization', 'name' => get_post_meta($post_id, 'organization_name', true), 'sameAs' => get_post_meta($post_id, 'organization_url', true), ]; return $schema; });
This does what I want, but there’s some default schema leftover that’s causing a warning. Also, there’s some unnecessary data being displayed.
Here’s what I’d like to remove:
– AggregateRating (isn’t recognized by the EmployerAggregateRating type)
– Description (isn’t necessary)
– URL (isn’t necessary)
– Image (isn’t necessary)Is this possible?
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Remove Default Schema Data | Start Fresh’ is closed to new replies.