[wp-trac] [WordPress Trac] #13382: _wp_post_revision_fields filter is not very useful
WordPress Trac
wp-trac at lists.automattic.com
Thu May 13 20:57:51 UTC 2010
#13382: _wp_post_revision_fields filter is not very useful
-------------------------+--------------------------------------------------
Reporter: mdawaffe | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.1
Component: Revisions | Version: 3.0
Severity: normal | Keywords:
-------------------------+--------------------------------------------------
The _wp_post_revision_fields filter allows plugins to modify which post
fields get revisioned (the default is title, content, excerpt).
It's pretty useless, though, since it's only run once and can't be changed
by post_type. A custom post type, for example, might only want to enable
revisions on the content.
The _wp_post_revision_fields() is also a variation on the getter/setter
pattern (static variable) we use in a few places to avoid globals. It
makes the function kind of crazy.
Proposal: Split into two functions
{{{
@var int|object|array $post post_id or post object or post array
@return array Fields to revision: array( field => i18n'd label )
function wp_get_post_revision_fields( $post ) {
// filter with _wp_post_revision_fields: pass post_id, post_type, ...?
// don't cache results
}
@internal
@var array $past post array
@return array Filled $post array with revision info
function _wp_post_revision_fields( $post ) {
$revisionable = wp_get_post_revision_fields( $post )
// ...
}
}}}
I'd like to see this in 3.0 if we can, but marking as 3.1 for now.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/13382>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list