1. Home
  2. Knowledge Base
  3. How to Prevent Modified Date of Your Blog Posts from Being Updated?

How to Prevent Modified Date of Your Blog Posts from Being Updated?

When your website’s links are shared on social media platforms like Facebook, they use the Open Graph’s meta tags to fetch information about the page. Rank Math adds them automatically, like the one below…

Meta tags in Open Graph

You can further refer to our dedicated article on using Open Graph Meta tags in Rank Math.

For any reason, you could remove your posts’ modified and updated dates from being included in those meta tags using code snippets. In this knowledgebase article, we’ll show you how to remove the Modified and Updated Time meta tags from Open Graph.

1 How to Remove Modified Time Open Graph Meta Tags?

The first step is to head over to the Theme File Editor from your WordPress Dashboard. If you use a Classic theme, navigate to Appearance > Theme File Editor, as shown below. If you use a Block theme, navigate to Tools > Theme File Editor.

Navigate to Theme file editor

1.2 Add the Code Snippet

To prevent the modified date from being updated, add the below code snippet to your theme’s functions.php file.

add_filter('rank_math/opengraph/facebook/og_updated_time', function ($content) {
	return false;
});

add_filter('rank_math/opengraph/facebook/article_modified_time', function ($content) {
	return false;
});

To do so, navigate to the functions.php file, and add the above code snippet, as shown below.

Add code snippet

1.3 Save the Changes

Once you’ve added the code snippet, click on the Update File button to save the changes made to the file.

Click the Update File button

If you have any questions about removing Open Graph meta tags or adding filters to WordPress, you’re always more than welcome to contact our dedicated support team. We’re available 24/7, 365 days a year… 

Was this article helpful?

Still not using Rank Math?

Setup takes less than 5 minutes including the import from your old SEO Plugin!

Learn more about the PRO Version

Still need help?

?

Submit Your Question

Please give us the details, our support team will get back to you.

Open Ticket