The question of how to customize which post data gets updated has been answered elsewhere on StackExchange.
Here is a specific example of how to stop the modified date from being updated:
function stop_modified_date_update( $new, $old ) {
$new['post_modified'] = $old['post_modified'];
$new['post_modified_gmt'] = $old['post_modified_gmt'];
return $new;
}
add_filter( 'wp_insert_post_data', 'stop_modified_date_update', 10, 2 );
// do stuff that updates post(s) here
remove_filter( 'wp_insert_post_data', 'stop_modified_date_update', 10, 2 );
NB: It is extremely important to remove the filter when you’re done with your special tasks unless you really want the modified date to never update anywhere on the site.
Happy coding!
Related Posts:
- Verify if tag is used on posts
- How to change the case of all post titles to “Title Case”
- Apply the_title() filter in post & page title, but not in menu title
- WordPress removing tags?
- Add tag to post api wordpress
- Set tags for a post – without tag creation
- Remove post title input from edit page
- Set Post Title to Read-only and Disable Permalink Slug Editor in Gutenberg
- How to remove Nextpage tag inside posts text depending of utm_campaign
- Disallow Same Post Title
- Get title of post without using the_title();
- Plain-text tag list?
- Display posts by tag on page
- Dynamically update post title in admin page
- Edit a post from frontend. post_tags get saved, but not separated
- Convert IPTC keywords to blog post tags
- How to show posts rank based on custom field value
- how to limit and display tag?
- Include related posts on a page
- Displaying Page Title on index.php
- How to display post tags
- How to add shortcode tags in single.php [closed]
- Remove post_tag from default post type, add custom taxonomy
- What Defines What Category A Post Picks (if in multiple)
- How to intercept Post Title on Post-Save
- Testing for post title in ‘if/else’ statement returns no content
- get_post_field – Title without paragraph
- Add Category name to Post Title (h1)
- How to add a custom field after wp post
- Does an action fire when adding a tag via the “Tags” meta box?
- Sorting posts alphabetical that have single digits
- how to programmatically change post tags
- How Can i Get 5 Recent Post Title With Corresponding Link?
- Filter Posts By Tag
- WordPress post tag & custom field
- WP Query related posts by current page Tag ID
- How to display all posts assigned to some tag?
- How To Add One Tag to Multiple Posts?
- Add Post Tags to Body Class
- I want to show category in the post title , how can I do
- How to display following posts titles in separate div’s on a separate webpage
- WP Query – duplicated posts once including tags in search results
- wp_tag_cloud() and the_taxonomies() work but not the_tag()
- Blog Posts not showing title
- Lose “Blog Archive” from page title
- Tags to Post-ID mysql query. Tag Search
- How to add Tags Filter in wordpress admin dashboard
- Prepend or add an Image to the content of a Post
- Display post from current category and same tag?
- How to Orderby Comments by post title?
- WordPress not opening posts with only numbers if permalink is post_name
- Should I use posts or pages in this scenario?
- Display posts with tag that matches current post title
- How can I make a post that belongs to a category or have specific tags, display different from the other single posts?
- Using permalinks, category slugs, and tag slugs
- “more” tag doesn’t appear when browsing category achives or search
- Print all the tags from a custom post type Please
- Display tag image in post using Taxonomy Images plugin index.php
- Add multiple tags to multiple posts
- Help with Taxonomies
- WP_Query: Mixing category__in and tag__in together
- sql select for post_title and a term name
- How to add tags (custom taxonomy) to post class css?
- How can I hide tags on a child-category page, if that tag has not been used?
- how to add text to posts from tags
- WordPress is replacing double minus signs in Post Title, how to disable it?
- How do I change the core post search algorithm? Where is it found/constructed?
- How to get Tags with specific post id
- Is there a way to specify an extra class for a post or page with no title?
- How to get a post’s content? [closed]
- How Do I Get My Post Tags to Alphabetize?
- WordPress query_posts by tag doesn’t work anymore(?)
- Add title for previous and next posts to Yoko Theme
- Images inside post title
- Conditionals if tags exist?
- Loop doesn’t show title of second post and posts thereafter
- How To capitalize The First Letter Of Every Word In The Post Title
- Displaying posts that belong to a specific author
- How to show show the Second page title in the page
- Display related post by tag name of current post
- How to get links to the last N posts in a specific category?
- Create a list of posts with topic headdings
- How to remove specific tag from multiple posts?
- Blog post not showing title
- How can I remove the first two words and shorten get_the_title()
- How do I include the category next to the title of a post?
- Extracting relevant tags associated with that particular single post only
- How to change the layout of posts when viewing all posts by tag [closed]
- See if a post has a specified tag
- Count several post tags
- How to get post with associated categories and tags names instead of ids with rest api?
- How to style archive post titles… but only those posts who have comments?
- Replace image name on upload to the new post name on front-end form
- Edit the post title from the frontend
- Why in my query is display two title?
- Does WP automatically tag posts into the archive?
- Tags on products vs tags on blog posts. An easy way to duplicate them
- Changing Post Tag Color Based On Post Count
- Image behind the post’s title
- Change Post Title For Specific Category