Opened 9 years ago
Closed 9 years ago
#36526 closed defect (bug) (fixed)
Not needed postmeta saved when restoring post revision
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.6 | Priority: | normal |
Severity: | normal | Version: | 3.6.1 |
Component: | Revisions | Keywords: | has-patch |
Focuses: | Cc: |
Description
WordPress stores postmeta _post_restored_from
when user restores some revision, but this is never used throughout core? I did not find any notice, that this postmeta is used somewhere and only database is bloated?
https://core.trac.wordpress.org/browser/tags/4.5/src/wp-includes/revision.php#L387
Attachments (1)
Change History (9)
#2
@
9 years ago
Was just going to post the same ticket number, but ocean90 beat me to it.
I guess we can remove it as long as no plugins rely on it? Although they shouldn't, of course.
#4
@
9 years ago
- Keywords needs-patch added
Plugin directory search for _post_restored_from
returned only two results:
simple-history/loggers/SimplePostLogger.php // Array with custom field keys to ignore because changed everytime or very internal $arr_meta_keys_to_ignore = array( "_edit_lock", "_edit_last", "_post_restored_from", "_wp_page_template" ); wr-pagebuilder/core/converter/converter.php $post_meta = $wpdb->get_results( "SELECT * FROM {$table_prefix}postmeta WHERE post_id = {$this->post->ID};" ); $ignore = array( '_edit_last', '_edit_lock', '_post_restored_from' ); foreach ( $post_meta as $meta ) { if ( ! in_array( $meta->meta_key, $ignore ) ) { $wpdb->query( "INSERT INTO {$table_prefix}postmeta (post_id, meta_key, meta_value) VALUES ({$id}, '{$meta->meta_key}', '{$meta->meta_value}');" ); } }
I think we should be able to remove it in a DB upgrade routine for 4.6.
#5
@
9 years ago
- Milestone changed from Awaiting Review to 4.6
- Owner set to swissspidy
- Status changed from new to assigned
Thanks @SergeyBiryukov!
I'll work on this DB upgrade routine + the removal of the lines in question.
Added in [23769] and [23811], see ticket:23497:124. Unused since [25194].