• Resolved riccarbi

    (@riccarbi)


    I tried to change the schema.org type from “article” to “Museum”
    by adding

    <?php
    add_filter(‘wp_postratings_schema_itemtype’, ‘wp_postratings_schema_itemtype’);
    function wp_postratings_schema_itemtype($itemtype) {
    return ‘itemscope itemtype=”https://schema.org/Museum”&#8216;;
    }
    ?>

    to functions.php,but I get a 500 – server error.
    Someone else have tried witch such code and got it working?
    Is there a workaround through which I could change the default Schema.org type in the plugin code rather than working on functions.php?

    Any help is very appreciated!

    https://ww.wp.xz.cn/plugins/wp-postratings/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Lester Chan

    (@gamerz)

    you might not need the opening <?php and ?> if you have existing functions.php.

    Just ensure your functions.php have a <?php and you can just paste

    add_filter('wp_postratings_schema_itemtype', 'wp_postratings_schema_itemtype');
    function wp_postratings_schema_itemtype($itemtype) {
    return 'itemscope itemtype="https://schema.org/Museum"';
    }

    below it

    Thread Starter riccarbi

    (@riccarbi)

    Wow Lester, that’s a quick support!

    Thanks so much, it works. Yet I have to tweak a bit with my JSON_LD code since it no more validates (I guess have to modify the set of properties so it match those required by the modified type)

    Thread Starter riccarbi

    (@riccarbi)

    I guess that the best options could be to add a proper AggregateRating property to my JSON-LD code and call the aggregate rating from WP-PostRatings via php. I dig a bit into this.

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

The topic ‘Changing Schema.org type brokes website’ is closed to new replies.