Remove “og:type” product

#305667
  • Resolved Jesper Holst
    Rank Math free

    Hi! I’m running a wholesale (b2b) webshop on WP/Woocommerce, where I don’t want prices to be displayed to customers without them loggin in.
    I believe I have removed all traces on the page, but my images (and prices) still shows as “Product” in Google Image Search.

    I wan’t to try to change the schema markup on all product single pages (woocommerce products) from “product” to “article”. Hopefully that will make Google NOT see the images as products (and therefor show the price).

    How can I change the og:type in rank math? I did try to go to Rank Math -> Titles & Meta -> Products -> Schema Type and set it to “none”. But the og:type is still “product”. How do I change this?

    Thanks! 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • Kamlesh
    Rank Math free

    Hello,

    Thank you for contacting Rank Math.

    In order to change og:type in product pages, please add the below-mentioned code in your theme’s functions.php file:

    add_filter( 'rank_math/opengraph/type', function( $type ) {
     if(is_product()){ 
         return "article"; // Here, write the name of schema that you want to be displayed in og:type
     }
    	return $type;
    });

    Here’s a link for using a filter on your site:
    https://rankmath.com/kb/filters-hooks-api-developer/#adding-filters-and-hooks-in-rank-math-php

    I hope that helps.

    Thank you.

    Hi Kamlesh

    Works perfectly. Thanks for providing more documentation. Have a great evening. 🙂

    Hello,

    We are super happy that this issue is already resolved. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind us asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

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

The ticket ‘Remove “og:type” product’ is closed to new replies.