[wp-trac] [WordPress Trac] #22289: Filter to override WP_POST_REVISIONS (or define it later)
WordPress Trac
noreply at wordpress.org
Thu Feb 21 05:26:43 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: westi-likes needs-refresh needs-patch => westi-likes has-patch
Comment:
[http://core.trac.wordpress.org/attachment/ticket/22289/22289.2.patch
22289.2.patch] simplifies the approach for this ticket, following @westi's
advice. It introduces the `wp_revisions_to_keep` filter, which lets users
specify a number of revisions to store based on post type.
Backwards compatibility is achieved by first checking the value of the
`WP_POST_REVISIONS` constant. If `true`, PHP's `INF` constant is used to
indicate that all revisions should be stored. If `WP_POST_REVISIONS` is
false or a positive integer, that value's numeric representation is used.
If, for whatever reason, either `WP_POST_REVISIONS` or the value returned
via `wp_revisions_to_keep` is negative, `_doing_it_wrong` is invoked and
the number of revisions to be stored is set to zero.
With the patch applied, all unit tests present as of
[http://core.trac.wordpress.org/changeset/1219/tests 1219/tests] passed,
save one pertaining to media that failed against a clean checkout of trunk
as of r23460.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22289#comment:13>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list