API / Minn\Runtime / PostRevisions

PostRevisions final class

Minn\Runtime\PostRevisions · public/minn/src/Minn/Runtime/PostRevisions.php · 67 lines

A post's revisions as the reference's wp_save_post_revision keeps them (probe revisions): only for a type that supports revisions and while wp_revisions_to_keep allows any; compared with the latest revision (wp_save_post_revision_check_for_changes, the revision fields with their whitespace evened out, wp_save_post_revision_post_has_changed, whose default also compares the revisioned meta); saved through wp_insert_post and _wp_put_post_revision (whose default copies the revisioned meta); then the oldest dropped past the limit, after wp_save_post_revision_revisions_before_deletion.

Public

staticsave(WP_Post $post): ?int#

The new revision's id, or null when none was called for.

staticput(array $data): ?int#

The revision (or autosave) row _wp_post_revision_data made, written through wp_insert_post, then _wp_put_post_revision; its id.

$dataarray<string, mixed>

Internals 2

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatechanged(WP_Post $latest, WP_Post $post): bool#

Whether the post differs from its latest revision in the revision fields, or a plugin says so.

privateprune(WP_Post $post): void#

The oldest revisions past wp_revisions_to_keep removed (autosaves stay).