Hiding Meta Product Price (product:price:amount)

  • Hi,

    For a B2B website with price only available for logged in users (and depending of the users), I need to make prices unavailable for public viewing. I saw the code provided here: https://support.rankmath.com/ticket/hide-product-price/

     * Filter to modify Rank Math product schema data
     * Replace $schema_type with schema name like article, review, etc.
     * @param array $entity Snippet Data
     * @return array
    add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
    	return $entity;

    which removes it from the Rich Snippet, but I’d be looking to also hide the Opengraph meta generated from the price.

    Ex.: <meta property="product:price:amount" content="2.99">

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    You could try using this one:

     * Allow developers to change the content of specific social meta tags.
     * The dynamic part of the hook name. $network, is the network slug
     * and $og_property, is the property which we are outputting.
     * @param string $content The content of the property.
    add_filter( "rank_math/opengraph/facebook/product_price_amount", function( $content ) {
        return '';

    Looking forward to helping you. Thank you.


    That did the job!

    Thank you


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

    If you don’t mind me 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 do 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)

You must be logged in to reply to this ticket.