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…
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
1.1 Navigate to the Theme File Editor
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.
1.2 Add the Code Snippet
To prevent the modified date from being updated, add the below code snippet to your theme’s rank-math.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 rank-math.php file, and add the above code snippet, as shown below.
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.
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…