Removing Datemodified and Datepublished doesn’t work anymore

#676623
  • Resolved Anonymous
    Rank Math free

    I’ve been using your code for a while which originally worked, but as of lately all the dates are back on my product page serps. It appears datemodified and datepublished is in the schema again even with the below code…

    add_filter( ‘rank_math/snippet/rich_snippet_article_entity’, function( $entity ) {
    unset( $entity[‘datePublished’] );
    unset( $entity[‘dateModified’] );
    return $entity;
    } );
    add_filter( ‘rank_math/json_ld’, function( $data, $jsonld ) {
    if ( ! isset( $data[‘WebPage’] ) ) {
    return $data;
    }
    unset( $data[‘WebPage’][‘datePublished’] );
    unset( $data[‘WebPage’][‘dateModified’] );
    return $data;
    }, 99, 2 );
    add_filter( ‘rank_math/opengraph/facebook/og_updated_time’, ‘__return_false’);
    add_filter( ‘rank_math/opengraph/facebook/article_published_time’, ‘__return_false’);
    add_filter( ‘rank_math/opengraph/facebook/article_modified_time’, ‘__return_false’);
    /**
    * Filter to remove lastmod from sitemap index
    */
    add_filter( ‘rank_math/sitemap/index/entry’, function( $index, $type ) {
    if ( isset( $index[‘lastmod’] ) ) {
    unset( $index[‘lastmod’] );
    }
    return $index;
    }, 10, 2 );

    Webpage here: https://www.cobathandbody.com/turmeric-exfoliating-sugar-scrub/

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

    I apologize for the inconvenience you are facing with the date properties not being removed from your product page SERPs. It seems that the code you have been using to remove the date properties is not working as expected.

    It’s possible that there have been changes in the Rank Math plugin that affect how these filters work. To address this issue, I recommend reaching out to our support team by assigning this ticket to a human agent using the available buttons. Our team will investigate the issue further and provide you with a solution to remove the date properties from your product page SERPs.

    Thank you for bringing this to our attention, and we appreciate your understanding as we work to resolve this issue for you.

    If you have any other questions or concerns, feel free to let us know.

    Sources:
    How to Remove Date Snippets from Search Results » Rank Math
    Rank Math SEO Filters and Hooks for Developers – Rank Math
    Resolving Rank Math Schema Markup Related Issues

    Hello,

    We’ve checked your site, and it seems that you’re using Rank Math PRO but the account you have used to open this ticket is the Rank Math free version.

    Can you please search and forward a receipt from FastSpring.com or the email address you used to purchase so we can locate your account and verify it?

    Regarding the issue, could you please confirm where you have placed the filter?

    If you have added the filter to your theme’s functions.php file, then the code could have been removed when your theme updates.

    You can add the filter to your theme/child theme’s functions.php file or use the Code Snippets plugin.

    Looking forward to helping you.

    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 2 replies - 1 through 2 (of 2 total)

The ticket ‘Removing Datemodified and Datepublished doesn’t work anymore’ is closed to new replies.