Add revisioning of post meta, including ‘footnotes’ by default#4859
Add revisioning of post meta, including ‘footnotes’ by default#4859adamsilverstein wants to merge 117 commits intoWordPress:trunkfrom
Conversation
… last stored revision
|
@adamsilverstein, should we try using |
Sure, good idea - I'll give it a try |
src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php
Show resolved
Hide resolved
|
Pinging @swissspidy as this change may effect the web stories plugin that has a custom revision / autosave endpoint. |
spacedmonkey
left a comment
There was a problem hiding this comment.
I tested this with the web stories plugin that has many custom post types and meta. Seems to work well. Just some little bits of feedback and we should be nearly ready to commit.
…troller.php Co-authored-by: Jonny Harris <spacedmonkey@users.noreply.github.com>
…troller.php Co-authored-by: Jonny Harris <spacedmonkey@users.noreply.github.com>
Co-authored-by: Pascal Birchler <pascal.birchler@gmail.com>
Co-authored-by: Pascal Birchler <pascal.birchler@gmail.com>
| $revision_id = _wp_put_post_revision( $post_data, true ); | ||
| } | ||
|
|
||
| if( is_wp_error( $revision_id ) ) { |
There was a problem hiding this comment.
@spacedmonkey thinking we should check for 0 here as well since _wp_put_post_revision can return 0.
There was a problem hiding this comment.
How about this?
if( 0 === $revision_id ) {
return new WP_Error(...
}
There was a problem hiding this comment.
$revision_id could be 0 OR a wp_error here so I think we need to check for both which is what I did.
Co-authored-by: Jonny Harris <spacedmonkey@users.noreply.github.com>
|
Do we need to update |
src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php
Outdated
Show resolved
Hide resolved
…troller.php Co-authored-by: Jonny Harris <spacedmonkey@users.noreply.github.com>
Not sure, I'm going to get this committed then we can revisit during beta. |
src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php
Show resolved
Hide resolved
| // Restore any revisioned meta fields. | ||
| wp_restore_post_revision_meta( $post_id, $revision['ID'] ); |
There was a problem hiding this comment.
| // Restore any revisioned meta fields. | |
| wp_restore_post_revision_meta( $post_id, $revision['ID'] ); |
@adamsilverstein This is not need anymore, as it hooked in the next line.
There was a problem hiding this comment.
👍🏼 will commit in a follow up
spacedmonkey
left a comment
There was a problem hiding this comment.
Good to commit. We will follow up with any issues.
Trac ticket: https://core.trac.wordpress.org/ticket/20564
Related Gutenberg Ticket: WordPress/gutenberg#52988
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.