Remove datepublished and datemodified from organisation schema / pages

#989957
  • Resolved Pab
    Rank Math free

    I’ve asked several times on wordpress.org and it keeps getting marked as resolved even though its not. When I respond, nobody responds.

    My homepage appears in google with a date next to the meta title. This is not wanted. Its fine for posts but shouldnt be for pages. I can see testing schema validation that in the output for oragnisation schema from rank math

    datePublished 2025-02-28T10:49:18+00:00
    dateModified 2025-03-14T12:13:31+00:00

    My guess is, Google is picking this up and using it to display a date next to the results. This impacts CTR in a bad way for evergreen content which is not updated frequently.

    I’ve added this to functions.php but I still see the dates as above in validator.schema.org

    Please advise how to remove this. I have asked a few times but keep getting the topic resolved before its actually resolved.

    add_filter(“rank_math/snippet/rich_snippet_article_entity”, function($entity) {
    // Only apply to pages and homepage, NOT to posts
    if (is_page() || is_front_page() || is_home()) {
    unset($entity[‘dateModified’]);
    unset($entity[‘datePublished’]);
    }
    return $entity;
    });

    // Remove OpenGraph date meta tags on all pages (including homepage)
    add_filter(‘rank_math/opengraph/facebook/og_updated_time’, function($time) {
    if (is_page() || is_front_page() || is_home()) {
    return false;
    }
    return $time;
    });

    add_filter(‘rank_math/opengraph/facebook/article_published_time’, function($time) {
    if (is_page() || is_front_page() || is_home()) {
    return false;
    }
    return $time;
    });

    add_filter(‘rank_math/opengraph/facebook/article_modified_time’, function($time) {
    if (is_page() || is_front_page() || is_home()) {
    return false;
    }
    return $time;
    });

    Essentially, I don’t want dates to be included on pages in the schema. As I am not adding it, but can see it in validator.schema I assume it coming from the organisation schema. Please tell me how to remove this for all pages. I want to keep it on posts, but I don’t want it on pages and I have no idea why this is a default behavior. Why would someone want dates appearing next to evergreen content? Its going to negatively impact CTR.

Viewing 1 replies (of 1 total)
  • Hello,

    We apologize for the issue you are facing with the date being displayed next to your homepage in Google search results. Thank you for raising this concern.

    To remove the datePublished and dateModified from the Organization Schema on your pages, you can use the following code snippet. This code will ensure that these date properties are not included in the schema output for pages and the homepage:

    add_filter('rank_math/json_ld', function( $data, $jsonld ) {
        if ( is_page() || is_front_page() ) {
            unset( $data['datePublished'] );
            unset( $data['dateModified'] );
        }
        return $data;
    }, 99, 2);

    Add this code to your theme’s rank-math.php file. This should help in preventing those dates from appearing in the schema for your pages.

    If you continue to see the dates after implementing this change, please ensure that you clear any caching plugins you may be using and check again in the schema validator.

    If you have any further questions or need additional assistance, please reply to this ticket, and a human agent from our support team will take over and assist you further.

    Thank you for your patience!

    Sources:
    Remove Organization Schema from Your Website » Rank Math

    This is an automated reply from Rank Math Support Bot. If you need further assistance, please reply to this topic and a human support agent will reply to you shortly.

    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 datepublished and datemodified from organisation schema / pages’ is closed to new replies.