HTTP/2 301
server: nginx
date: Sat, 11 Oct 2025 11:37:51 GMT
content-type: text/html; charset=UTF-8
location: https://developer.wordpress.org/reference/hooks/wp_revisions_to_keep/
x-content-type-options: nosniff
content-language: en
x-ua-compatible: IE=Edge
vary: Accept-Encoding, Cookie
expires: Thu, 01 Jan 1970 00:00:00 GMT
cache-control: no-cache, no-store, max-age=0, must-revalidate
pragma: no-cache
alt-svc: h3=":443"; ma=86400
strict-transport-security: max-age=31536000
HTTP/2 200
server: nginx
date: Sat, 11 Oct 2025 11:37:53 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-olaf: ⛄
vary: accept, content-type
link:
; rel="https://api.w.org/"
link:
; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
x-frame-options: SAMEORIGIN
content-encoding: gzip
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 2
wp_revisions_to_keep – Hook | Developer.WordPress.org
apply_filters( ‘wp_revisions_to_keep’, int $num, WP_Post $post )
Filters the number of revisions to save for the given post.
Overrides the value of WP_POST_REVISIONS.
$num
intNumber of revisions to store.
$post
WP_PostPost object.
- By default, an infinite number of revisions are stored if a post type supports revisions.
- Note that the filter callback functions must return a value after it is finished processing or the revisions will be empty.
Version | Description |
---|
3.6.0 | Introduced. |
Example migrated from Codex:
The example below sets the number of revisions for a theoretical post type ‘my_custom_post’.