Archived topic
Remove post date only if post date > 35 days
1 reply · Started by Alex on November 5, 2019
Viewing posts 1–2 of 2
Hello,
I have seen this post: https://support.rankmath.com/ticket/remove-published-date-from-google-results/
And want to ask how i can add a filter to that function, so the date of the post is not showing in the source code in the posts of more than 35 days.
Let me know please, regards!
Hi there,
Would the entire post date remove itself? Or only the published/updated?
You could try this:
add_filter( 'generate_post_date_output', function( $output ) {
if ( strtotime( $post->post_date ) < strtotime( '-35 days' ) ) {
return '';
}
return $output;
} );
Let me know :)
This archived topic is closed to new replies.