Elegantly prune post revisions

WordPress will trim revisions on a post when creating new revisions, this is how it does it at the end of wp_save_post_revision: // If a limit for the number of revisions to keep has been set, // delete the oldest ones. $revisions_to_keep = wp_revisions_to_keep( $post ); if ( $revisions_to_keep < 0 ) { return $return; … Read more

Saving Taxonomies to Post Revisions

WordPress only supports revisions for post content, not terms. To create a system that monitors changes in post-term relationships over time, you would have to write a plugin that explicitly handles that. If you’re interested in going down that route, you would probably need to use the save_post hook to save term data (saving as … Read more

How to Determine a Post’s Last Edited Date?

If I got your question right, and you want posts created/modified between 3 years ago and today, try this query: SELECT p.ID, concat(‘http://www.toronto.com/restaurants/’, p.post_name) FROM wp_posts p WHERE p.post_type=”restaurant” AND p.post_status=”publish” AND p.post_modified > DATE_SUB(now(), INTERVAL 36 MONTH); Because your DATE_SUB returns something like this: NOW – 3 years, so, it’s something along the lines … Read more