Remove open graph updated ,modified and published time form the meta tag

#477898
  • Resolved fouadabuhattab
    Rank Math free

    Hello, how can I remove the open graph updated, modified, and published time from the meta tag in the head of my pages on my website I’m using the following code but I think is a wrong

    add_action( ‘rank_math/head’, function() {
    remove_all_actions( ‘rank_math/opengraph/og:updated_time’ );
    });

    Can you help me to do that correctly?

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

    Thank you for contacting Rank Math support today and bringing your concern to our attention.

    Please refer to these filter codes instead:

    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');

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Thanks a lot that’s very useful for me

    Hi, Also I need to remove datepublished and datemodified parameters from my woocommerce product schema

    Is this code snippet correct?

    add_filter( ‘rank_math/snippet/rich_snippet_product_entity’, function( $entity ) {
    unset($entity[‘dateModified’][‘datePublished’]);
    return $entity;
    });

    Hello,

    You are merging two different properties which will not work. Please refer to this filter code instead:

    add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
      unset( $schema['dateModified'] );
      unset( $schema['datePublished'] );
      return $entity;
    });

    Let us know how that goes. Thank you.

    Hello, I’m adding your code snippet to functions.php but the dateModified and datePublised parameters are still in the woocommwece schema in my store.

    This is the code in the functions.php file

    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’);

    add_filter( “rank_math/snippet/rich_snippet_product_entity”, function( $entity ) {
    unset( $schema[‘dateModified’] );
    unset( $schema[‘datePublished’] );
    return $entity;
    });

    the first code for the open graph was removed published_time and modified_time successfully, but I need to remove parameters dateModified and datePublished from the woocommerce schema itself

    Thanks for your help and your help

    Hello,

    Could you please share a sample product URL on your site so we can check as well? You can add it to the sensitive data section upon editing your first post

    Sensitive Data Section

    It is completely secure, and only our support staff has access to that section.

    Meanwhile, please try this filter instead to remove the datePublished and dateModified:

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

    Let us know how this goes.

    Thank you.

    Thanks a lot that’s suitable for my situation.

    Hello,

    We are super happy that we have addressed your concern. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind us asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)

The ticket ‘Remove open graph updated ,modified and published time form the meta tag’ is closed to new replies.