• Resolved pedroreis

    (@pedroreis)


    Hello,

    I am trying to disable dateModified and datePublished info only in some posts, i had placed the following code in function.php, but does not work:

    function vanv_remove_published_modified_dates( $graph_piece ) {
    if ( is_single ( [ 531, 14145, 16179, 1006, 1337, 2083, 8, 15887, 17978, 18672, 2077, 15662, 17456, 14344 ] ) ) {
    unset( $graph_piece[‘datePublished’], $graph_piece[‘dateModified’] );
    return $graph_piece;
    }
    }
    add_filter( ‘wpseo_schema_article’, ‘vanv_remove_published_modified_dates’ );

    add_filter( ‘wpseo_schema_webpage’, ‘vanv_remove_published_modified_dates’ );

    Can you please help me, the objective is to google not show dates in snnipets.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello @pedroreis,

    Thanks for using the Yoast SEO plugin. Our plugin outputs?datePublished?and?dateModified?schema.org structured data. There’s no feature in our plugin to disable that. The plugin pulls the values in your WordPress dashboard when a post is published or modified respectively.

    Ultimately, Google decides whether or not a date appears on the search result page. As such, Yoast SEO automatically includes the date in the search preview. There are a few ways to influence Google, but implementing these options is beyond the scope of our support on Yoast SEO. However, we can refer you to an?article?where you can learn more about preventing dates from appearing in search results.

    You can also read the?Schema API – Documentation?to learn how to remove schema pieces.

    Plugin Support Jose Varghese

    (@josevarghese)

    This thread was marked resolved due to a lack of activity, but you’re always welcome to re-open the topic. Please read this post before opening a new request.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove dateModified and datePublished schema’ is closed to new replies.