[wp-trac] [WordPress Trac] #22289: Filter to override WP_POST_REVISIONS (or define it later)

WordPress Trac noreply at wordpress.org
Sat Jan 26 04:32:50 UTC 2013


#22289: Filter to override WP_POST_REVISIONS (or define it later)
-----------------------------------+--------------------
 Reporter:  batmoo                 |       Owner:
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  3.6
Component:  Revisions              |     Version:  3.4.2
 Severity:  normal                 |  Resolution:
 Keywords:  westi-likes has-patch  |
-----------------------------------+--------------------
Changes (by ethitter):

 * keywords:  needs-patch westi-likes => westi-likes has-patch


Comment:

 As [http://core.trac.wordpress.org/attachment/ticket/22289/22289.patch
 22289.patch] demonstrates, there are a variety of places where
 `WP_POST_REVISIONS` is used, and the data that is available and useful in
 each situation varies. As such, I opted to use `compact()` to ensure that
 a single filter is available, context about the filter calls is provided,
 and whatever data is available in each context is passed as well.

 From call to call, the `wp_post_revisions` filter will always provide a
 `context` array key in the additional data it passes, and a full post
 object is generally available. Beyond that, consistency is lost. In XMLRPC
 calls, it might be useful to know the username or blog ID of the request,
 whereas uses in `revisions.php` can call for the post, the current
 revision, or the two revisions being compared.

 For what it's worth, I also prepared a patch that uses a different filter
 in each of the three files impacted by this patch, but that seemed like
 more of a pain for users.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22289#comment:9>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list