How to Remove Date in Schema Markup

#189420
  • Resolved Kuotabisa
    free

    Hello RankMath,

    I am very satisfied with rank math plugin.

    However, I have an unresolved question in the schema markup articles.

    How to remove datePublished and dateModified in the schema markup article?
    Because after activating schema markup in the search results the date will be displayed.

    SS: http://prntscr.com/125pp8w

    Previously it didn’t show because the date had been disabled in the theme.

    Please find a solution.

    Thank you

Viewing 1 replies (of 1 total)
  • Hello,

    Thanks for contacting us. Sorry for the delay and any inconvenience that might have been caused due to that.

    Please paste the code given below in your theme’s/child theme’s functions.php file to remove the datePublished and dateModified from the schema markup:

    /*
     * Rank Math snippet to remove datePublished & dateModified from WebPage
     * 
     */
    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
        unset($data['WebPage']['datePublished']);
        unset($data['WebPage']['dateModified']);
    return $data;
    }, 99, 2);
    
    /*
     * Rank Math snippet to remove datePublished & dateModified from Article
     * 
     */
    add_filter( 'rank_math/snippet/rich_snippet_article_entity', function( $data ) {
        unset( $data['datePublished'] );
        unset( $data['dateModified'] );
        return $data;
    }, 10, 1 );

    Hope this helps. Let us know if you need any further assistance.

    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 ‘How to Remove Date in Schema Markup’ is closed to new replies.