How to use a Custom Image in Product Snippet

  • I am using product schema on my post and it is showing the default featured image besides the product details and star ratings. How can I use custom images for my product schema snippet on posts? I am not using Woocommerce.

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math today.

    You can use the customize the following filter and add it to your theme functions.php to modify the generated schema data in the front end.

    
    /**
     * Filter to change the 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_{$schema}_entity", function( $entity ) {
     return $entity;
    });
    

    Hope this helps you. Thank you.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this ticket.