- Installing SureRank
- SureRank Onboarding Guide
- How to Activate Your SureRank Pro License
- SureRank Dashboard Overview
- General Settings
- Advanced Settings
- Search Console – SureRank
- Managing URL Redirection in SureRank
- SureRank Feature Management – Quick Guide
- Robots.txt Feature in SureRank
- Sitemaps in SureRank
- How to Enable Video Sitemap in SureRank Pro
- How to Enable the News Sitemap in SureRank
- How to Show the HTML Sitemap on Your Site in SureRank Pro
- How to Regenerate the Sitemap After Excluding a Post Type in SureRank
- Change the Sitemap URL in SureRank
- How to Enable Author Sitemap in SureRank
- How to Fix WWW and Non-WWW Version Redirects to Improve Your SEO
- How to Fix: No H1 Heading Found on Your Homepage
- How to Fix Missing H2 Headings on Your Homepage
- Re-run Checks Button in SureRank
- Fix Critical Error: Another SEO Plugin Detected in SureRank
- Fix Warning: Site Tagline Is Not Set in SureRank
- How to Fix Multiple SEO Plugins Detected on Your Site
- How to Fix: Homepage is Not Indexable by Search Engines
- Warning: Homepage Does Not Contain Internal Links
- How to Fix Missing Alt Text on Homepage Images
- How to Fix: Search Engine Title is Missing on the Page
- Page Level SEO: Broken Links Detected
- How to Fix Missing Alt Text on Images
- How to Fix Page URLs That Are Too Long
- Page Level SEO Warning: No Links Found on This Page
- Page Level SEO Warning: No Images or Videos Found
- Page Level SEO Warning: Missing Search Engine Description
- Page Level SEO Warning: No Subheadings Found on This Page
- Page Level SEO Warning: Canonical Tag is Missing
- Page Level SEO Warning: Open Graph Tags Missing
- What is Google Search Console and how does SureRank use it?
- Recommended Image Sizes
- SureRank – SEO Check Severity Guide
- Using SureRank with Other SEO Plugins – Best Practices
- Import/Export Feature – SureRank Plugin
- What is llms.txt and Does SureRank Support It?
- Does SureRank offer a keyword rank-tracking feature?
- Does SureRank Come With Google Analytics Integration?
- Email Summary in SureRank
- SureRank Role Manager
- Customize XML Sitemap Top Bar with surerank_sitemap_top_bar_data
- Analyze ACF Field Content with SureRank
- Preserve Modified Date During Updates surerank_freeze_modified_date
- Customize Final Title Tag surerank_final_title
- Customize Post Type Archive Title Output surerank_post_type_archive_title
- Customize Archive Page Title with surerank_archive_title
- CustomizeModify the Search Results Page Title surerank_search_title
- Customizing the 404 Page Title surerank_not_found_title
- Customizing the Title Separator surerank_title_separator
- How to Remove Archive Prefixes from Titles Using SureRank
- Customize Homepage Pagination Format surerank_homepage_pagination_format
- Customize Maximum SEO Title Length surerank_title_length
- Enable/Disable Pagination in SureRank Archives surerank_show_pagination
- Show or Hide Site Name in SEO Title surerank_show_site_name
- Customize Robots Meta Tags surerank_robots_meta_array
- Add “noindex” to Paginated Pages surerank_noindex_paginated_pages
- Customize Meta Description Length surerank_description_length
- Customize Product Category Rewrite Rules surerank_product_category_rewrite_rules
- Remove Product Category Base surerank_remove_product_category_base
- Customize Category URL Structure surerank_remove_category_base
- Disable Permalinks in RSS Feeds surerank_disable_permalink_in_feed
- Customize Maximum URL Slug Length surerank_url_length
- Disable Feed Indexing in SureRank surerank_disable_feed_indexing
- Open External Links in New Tab
Preserve Modified Date During Updates surerank_freeze_modified_date
Hook:Â surerank_freeze_modified_date
Description: The surerank_freeze_modified_date filter lets you preserve the existing post_modified and post_modified_gmt values when a post is updated. This is useful for programmatic updates where you want to change post content or metadata without making WordPress treat the post as newly modified.
Source:Â inc/functions/modified-date-lock.php
Usage: Use this filter when you need to keep the current modified timestamp intact during a post update. SureRank checks this filter only for existing posts, and skips revisions and autosaves.
Example
/**
* Preserve the modified date for a specific post during updates.
*/
add_filter(
'surerank_freeze_modified_date',
function ( $freeze, $post_id ) {
if ( 123 === (int) $post_id ) {
return true;
}
return $freeze;
},
10,
2
);
Example: Freeze modified dates for updates triggered by a custom process.
/**
* Preserve modified dates for posts updated by a custom sync routine.
*/
add_filter(
'surerank_freeze_modified_date',
function ( $freeze, $post_id, $post, $data, $postarr, $unsanitized_postarr ) {
if ( ! empty( $unsanitized_postarr['my_custom_sync'] ) ) {
return true;
}
return $freeze;
},
10,
6
);
Arguments:
- $freeze (bool) Whether to preserve the modified timestamp. Default false.
- $post_id (int) Post ID being updated.
- $post (\WP_Post) Current post object from the database before the update.
- $data (array) Sanitized post data that will be sent to WordPress.
- $postarr (array) Post data array for the update request.
- $unsanitized_postarr (array) Original unsanitized post data before WordPress processing.
Notes:
- This filter only runs during post updates, not new post creation.
- Revisions and autosaves are ignored.
- Returning true preserves only post_modified and post_modified_gmt. Other post fields still update normally.
- Use this only when you intentionally want to avoid changing the visible modified date.
You can add the example code to your child theme’s functions.php file or use a plugin like Code Snippets to safely insert custom code. Using a code snippet plugin is recommended for easier management and to keep the customization active even when changing themes.
We don't respond to the article feedback, we use it to improve our support content.