WordPress filter hook · part of WordPress core

_wp_post_revision_fields

A WordPress core filter that 7 plugins also fire themselves, running on 3.1M+ sites between them.

“This filter is documented in wp-admin/includes/revision.php”

How to use _wp_post_revision_fields

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( '_wp_post_revision_fields', function( $fields, $post_array ) {
	// Change $fields here.
	return $fields;
}, 10, 2 );

Argument names come from Yoast Duplicate Post's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

This hook is fired by WordPress core too. Official reference on developer.wordpress.org →

7 plugins that fire _wp_post_revision_fields

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Yoast Duplicate Post icon Yoast Duplicate Post3+ million installs apply_filters( '_wp_post_revision_fields', $fields, $post_array ) src/handlers/check-changes-handler.php:146
  2. WPVibe icon WPVibe100,000+ installs apply_filters( '_wp_post_revision_fields', $fields, get_post( $post->ID, ARRAY_A ) ) includes/class-wpvibe-revision-guard.php:68
  3. PublishPress Revisions: Duplicate Posts, Submit, Approve and Schedule Content Changes icon PublishPress Revisions: Duplicate Posts, Submit, Approve and Schedule Content Changes10,000+ installs apply_filters( '_wp_post_revision_fields', $fields, $post ) admin/history_rvy.php:597
  4. Cowboy MCP icon Cowboy MCP2,000+ installs apply_filters( '_wp_post_revision_fields', [ 'post_title' => 'Title', 'post_content' => 'Content', 'post_excerpt' => 'Excerpt' ], $parent->to_array() ) includes/tools/core/revisions.php:17
  5. Duplicate Post by AIOSEO icon Duplicate Post by AIOSEO100+ installs apply_filters( '_wp_post_revision_fields', $fields, get_post( $revision, ARRAY_A ) ) app/Main/Admin/ComparePage.php:137
  6. FrontKit for WordPress icon FrontKit for WordPress10+ installs apply_filters( '_wp_post_revision_fields', $fields ) includes/class-frontkit-rest-post-autosave-controller.php:326
  7. BuddyPress Group Wiki icon BuddyPress Group Wiki10+ installs apply_filters( '_wp_post_revision_fields', $last_revision->post_content ) content-pages/wiki-edit-save.php:328

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.