Remove Dates from Website Schema

#135185
  • Resolved Garry
    Rank Math free

    Hi there, On a WooCommerce site Rank Math is adding the following schema on all product pages

    {
          "@type": "WebPage",
          "@id": "https://example.com/product/xxx-xxx/#webpage",
          "url": "https://example.com/product/xxx-xxx/",
          "name": "Product Title",
          "datePublished": "2021-01-14T16:41:00+00:00",
          "dateModified": "2021-01-14T17:48:05+00:00",
          "isPartOf": {
            "@id": "https://example.com/#website"
          }

    This includes datePublished and dateModified as a result Google is showing date before product meta description in Search Results.

    How do I remove the date from this schema?

    I don’t have a date anywhere else on the page or in HTML except OG meta property; if possible, I want to remove the date from there.

    I don’t use Product Schema Type for WooCommerce products if that matters.

    Thanks 🙂

Viewing 1 replies (of 1 total)
  • Danial
    Rank Math business

    Hello,

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

    Google recommends these properties for your schema markup. If you still wish to remove this you can use the following filter:

    
    /**
     * Collect data to output in JSON-LD.
     *
     * @param array  $unsigned An array of data to output in json-ld.
     * @param JsonLD $unsigned JsonLD instance.
     */
    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
    	unset($data['WebPage']['datePublished']);
    	unset($data['WebPage']['dateModified']);
    	return $data;
    }, 99, 2);
    

    The code is to be customized and added to your theme functions.php file.

    I hope this resolves your issue.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Remove Dates from Website Schema’ is closed to new replies.