Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save FrancoStino/6c30427ea1d99c640eff4d07ad6bfa19 to your computer and use it in GitHub Desktop.
Save FrancoStino/6c30427ea1d99c640eff4d07ad6bfa19 to your computer and use it in GitHub Desktop.
Remove price schema Rank Math in the OpenGraph tags and schema rich snippets
<?php
/**
* Allow developers to prevent the output of the price in the OpenGraph tags and schema rich snippets.
*
* @param bool unsigned Defaults to true.
*/
add_filter( 'rank_math/woocommerce/og_price', '__return_false' );
add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {
if ( isset( $entity['offers'] ) ) {
unset( $entity['offers'] );
}
return $entity;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment