[wp-trac] [WordPress Trac] #13382: _wp_post_revision_fields filter is not very useful
WordPress Trac
noreply at wordpress.org
Thu Oct 22 14:57:52 UTC 2015
#13382: _wp_post_revision_fields filter is not very useful
------------------------------+------------------------------
Reporter: mdawaffe | Owner: adamsilverstein
Type: enhancement | Status: assigned
Priority: normal | Milestone: Future Release
Component: Revisions | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch commit | Focuses:
------------------------------+------------------------------
Comment (by SergeyBiryukov):
[attachment:13382.2.diff] doesn't seem like it would actually be useful,
since the post data is only passed to the filter when preparing the
revision for saving, but not when retrieving the fields.
From [source:tags/4.3.1/src/wp-includes/revision.php#L9
_wp_post_revision_fields() description]:
> Does two things. If passed a post *array*, it will return a post array
ready to be inserted into the posts table as a post revision. Otherwise,
returns an array whose keys are the post fields to be saved for post
revisions.
This is extremely confusing. The former should be a separate function.
In [attachment:13382.3.diff]:
* Move the array processing to a new function, `_wp_post_revision_data()`.
* Make both functions accept a post array or a `WP_Post` object.
* Always apply the `'_wp_post_revision_fields'` filter.
* Always pass the post data to the `'_wp_post_revision_fields'` filter.
* All unit tests pass.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/13382#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list