Looks like I was on the right track.
using update_post_meta
does not update the modified date of a post, so what you have to do is update the content of the post.
Luckily for me, I was not using the content, only custom meta. So updating the content with a random string whenever I updated post meta works. If you are using the content as well, then maybe updating the content with the same value will work as well (as in WordPress does not check to see if the content actually changed when marking as modified).
For those wondering, here is the code to update post content.
$my_post = array(
'ID' => $postID,
'post_title' => 'title of the post',
'post_content' => 'content of the post',
);
// Update the post into the database
wp_update_post( $my_post );
I hope this helps someone else, as I think it’s silly that updating meta values does not count towards post modify date 🙁
Related Posts:
- WP_Query on custom post type not displaying, multiple loops & get_template_part
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- wp_query to find posts by year and month
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- How do I list a custom field and custom taxonomies for each result in a loop?
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- sorting in wp query based on custom field value
- WordPress query in which condition uses custom field
- WordPress loop add heading before first of type
- How to make a shortcode for my WP_Query Loop? [duplicate]
- Error in WP Query. If variable is empty it is displaying previous post value
- How do you get the count of posts in an archive page?
- WP_Query orderby custom field then post_date in one query
- how to filter by last name for custom post
- Filtering a WP_Query meta_query by numeric values isn’t working
- WP_Query to loop a Custom Field, Custom Post Types do not show
- How to show posts from multiple post types in a single loop? And display them separately on the same template
- Get post info inside modal window?
- Get_post_meta() won’t return value
- Query Custom Post by Category
- Having trouble with custom date field for CPT query (WordPress)
- Display posts if a custom field value is equal to another custom field value
- WP_Query and using a variable for ‘cat’=> in the args array = WP Bug?
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- Display custom post on home page based on a metabox selection
- Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?
- Lists Posts from CPT that match the Title of the Page
- Filtering by Post Meta Custom Fields – Performance
- WP Query—Relationship between two custom post types and their fields
- Remove duplicated values from a loop
- How to insert content from another Custom Post type into Post?
- WordPress custom loop filter by meta_key and value with serialize data
- Returning a list of custom post types excluding those without a specific meta_value
- Custom loop with multiple taxonomy queries
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- WP_Query order by custom field, then randomly order some of results
- Store CPT ‘Reviews’ average ratings to a WordPress DB table or to a DB custom table?
- Get Posts by multiple custom fields is not working
- Problem: wp_query outputs all images on site
- Multiple Custom Post Type queries, how to DRY it up
- Using wp_query to modify the loop in index.php for a CPT
- Custom WP_Query doesn’t display all posts
- Query & the_content() is showing in the header
- post_per_page ignored in WP_Query
- How to conditionally add Custom Post Type to Front Page
- Pagination not working on custom query on a page
- Display custom post type for specific user
- Trying to add a class to post links
- List all Custom Post Type posts excluding certain Taxnomy term
- Get post-meta value of all custom-posts – lowest to highest year-count?
- Custom PT, Taxonomys and wordpress query
- How can i loop through custom post type according to custom meta field?
- Custom Post Type Query W/Category Dropdown
- Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?
- Custom post type pagination error
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- WP query_posts group by meta field related
- Page that lists publications by classifying them by taxonomy
- posts_per_page in custom WP_Query does not override “Reading” settings?
- WP Query from two Custom Post type fields as statement
- Exclude a specific post in a Custom Post Type
- Pin posts to top of custom loop
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- WP_Query get always custom post_type for first
- Filtering posts based on three taxonomies
- when looping through custom post data not appearing
- Order posts alphabetically with numbers but some of the posts has numbers in the title
- SEARCH QUERIES – REVERSE OUTPUT
- Error in the page of a CPT file in WordPress
- meta query multiple values for the same key
- Sort custom post archives by a meta value from a different custom post type?
- post_type incorrect for custom post type
- Staggering featured post using ‘sticky’
- Custom post types – meta_query: search lesson which starts sooner
- Adding a Section for Visitors
- Custom taxonomy template for custom fields loop [closed]
- Sort loop by custom field from different post type
- WordPress loop, show only one post per custom field
- How To Loop Through list with Custom Post Types
- Custom Post Type + Category archive
- How to get past and upcoming post by defining date in custom field?
- Post data in separate divs with incrementing class using WP_Query
- Selecting posts older than the current Unix epoch timestamp
- WP_Query get posts where post_name is empty
- Get result from Custom Field in Custom Post type
- Query recent posts by author
- Custom post-type’s pagination not working in category.php
- loop through custom post-type with two meta_keys
- Querying meta values within an array
- Filter Custom post type by another Custom post type
- How do I correctly query posts from a post ID?
- display custom post type from register taxonomy
- How to exclude certain portfolios from a loop
- Custom post type and have_posts() return empty result
- Display ACF object field data using Elementor Custom Query
- WordPress custom field sorting, weird behavior: the latest post is at the end
- How to insert a post from a different post type after every nth post
- Sort CPT by taxonomy AND THEN by custom field
- Complex Custom Loop with Includes