Title: Add aggregateRating
Last modified: September 26, 2017

---

# Add aggregateRating

 *  Resolved [cnotv](https://wordpress.org/support/users/cnotv/)
 * (@cnotv)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/add-aggregaterating/)
 * Is there any way and form to add extra markup, which theoretically should be 
   included, such as aggregateRating?
    [http://schema.org/aggregateRating](http://schema.org/aggregateRating)
 * I’m actually forced to hack the plugin locally, but I gues it should have already
   a JSON like:
 *     ```
           $json['aggregateRating'] = [
             '@type' => 'AggregateRating',
             'ratingValue' =>  '',
             'reviewCount' =>  ''
           ];
       ```
   
 * This should be added to the option in the dashboard, otherwise would make not
   so much sense just for header/body/author
    -  This topic was modified 8 years, 7 months ago by [cnotv](https://wordpress.org/support/users/cnotv/).

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Author [Hesham Zebida](https://wordpress.org/support/users/hishaman/)
 * (@hishaman)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/add-aggregaterating/#post-9532395)
 * Yes indeed, so you aren’t forced to hack the plugin in any way, you can do this:
 *     ```
       add_filter( 'schema_wp_types', 'schema_wp_new_add_schema_type_7623456' );
       /**
        * Add New type to Schema Types options
        *
        * @since 1.0
        */
       function schema_wp_new_add_schema_type_7623456( $options ) {
   
       	// Change 'NewType' to the actual schema.org type you want to add
       	// Example: Event, Product, JobPosting, ...etc.
       	$options['NewType'] =  array ( 
       					'label' => __('NewType'),
       					'value'	=> 'NewType'
       				);	
       	return $options;
       }
       ```
   
 * Here is a link to the [code gist](https://gist.github.com/schemapress/127a26aca8f70fd104fb161b4cafd9d9).
 * But, it’s not as simple as adding just the new type, you will have add other 
   properties as well to finally output a valid schema markup.
 * I suggest you look at the [free Schema Review plugin](https://wordpress.org/plugins/schema-review/),
   it will give you an idea of how you can achieve this by walking through its code.
    -  This reply was modified 8 years, 7 months ago by [Hesham Zebida](https://wordpress.org/support/users/hishaman/).
      Reason: adding link to code gist
 *  Thread Starter [cnotv](https://wordpress.org/support/users/cnotv/)
 * (@cnotv)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/add-aggregaterating/#post-9534391)
 * Thank you for the answer!
 * However noo, the idea is to keep exactly the same type and just extend it with
   the rating.
    As you can see the generic Article itself allows a sequence of options,
   one of those is aggregateRating: [http://schema.org/Article](http://schema.org/Article)
 * So instead of the Article Type, I just want to use the options of the meta box.
   
   Even better would be to just point a meta key without the need of an input. This
   is the option I mean:
 * > [View post on imgur.com](https://imgur.com/a/7GPmb)
 * Do you think is this possible? Or otherwise use an hook in the same way to extend
   the object for Article – Type General?
 * Thank you in advance!
    -  This reply was modified 8 years, 7 months ago by [cnotv](https://wordpress.org/support/users/cnotv/).
 *  Plugin Author [Hesham Zebida](https://wordpress.org/support/users/hishaman/)
 * (@hishaman)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/add-aggregaterating/#post-9536028)
 * Yes of course, you can keep the same type and extend it with rating or reviews,
   so yes this is absolutely possible.
 * However, in your code example, I see you’ve chosen type `AggregateRating`, which
   has a “`reviewCount`“, which leaded me to think you will need to introduce a 
   new schema.org type for it. I am not sure if this is what you want to do since
   the aggregate rating should have real user reviews published on the page.
 * You may look at using “reviewRating” instead of “AggregateRating” in case the
   latest doesn’t work, or gives you errors.
 * I hope this was useful.
 *  Thread Starter [cnotv](https://wordpress.org/support/users/cnotv/)
 * (@cnotv)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/add-aggregaterating/#post-9537758)
 * Yeah I agree would make no sense a rating without an actual review, but unfortunately
   the request is to stick just to votes, which is something already online in another
   CMS.
 *  Thread Starter [cnotv](https://wordpress.org/support/users/cnotv/)
 * (@cnotv)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/add-aggregaterating/#post-9538163)
 * I’ve been digging more into the snippets of code to alter the plugin without 
   hack it and I found probably what I need, since match with the same place I’m
   writing the code.
    [https://gist.github.com/schemapress/abf19698e702da7f27787d9bcb033e53](https://gist.github.com/schemapress/abf19698e702da7f27787d9bcb033e53)
 * A second part of the code is already written in another plugin where AJAX the
   rating is handled, with final meta data update, so it will synchronize with the
   whole project.
 * I’ll give a try and let you know, thank you for the support, snippet and plugin
   🙂
 *  Plugin Author [Hesham Zebida](https://wordpress.org/support/users/hishaman/)
 * (@hishaman)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/add-aggregaterating/#post-9539713)
 * Fantastic!
 * Let me know if you see a need for additional filters in the core code. I will
   be glad to add them in the Schema plugin to make things easier.
 *  Thread Starter [cnotv](https://wordpress.org/support/users/cnotv/)
 * (@cnotv)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/add-aggregaterating/#post-9545956)
 * Perfect all solved without hack!
    Thank you for the support 🙂
 *  Plugin Author [Hesham Zebida](https://wordpress.org/support/users/hishaman/)
 * (@hishaman)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/add-aggregaterating/#post-9546605)
 * Glad to hear that 🙂

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Add aggregateRating’ is closed to new replies.

 * ![](https://ps.w.org/schema/assets/icon-256x256.png?rev=1750173)
 * [Schema](https://wordpress.org/plugins/schema/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/schema/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/schema/)
 * [Active Topics](https://wordpress.org/support/plugin/schema/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/schema/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/schema/reviews/)

## Tags

 * [aggregaterating](https://wordpress.org/support/topic-tag/aggregaterating/)
 * [json-ld](https://wordpress.org/support/topic-tag/json-ld/)
 * [markup](https://wordpress.org/support/topic-tag/markup/)

 * 8 replies
 * 2 participants
 * Last reply from: [Hesham Zebida](https://wordpress.org/support/users/hishaman/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/add-aggregaterating/#post-9546605)
 * Status: resolved