Filter hook 'wp_save_post_revision_revisions_before_deletion'

in WP Core File wp-includes/revision.php at line 239

View Source

wp_save_post_revision_revisions_before_deletion

Filter Hook
Description
Filters the revisions to be considered for deletion.

Hook Information

File Location wp-includes/revision.php View on GitHub
Hook Type Filter
Line Number 239

Hook Parameters

Type Name Description
WP_Post[] $revisions Array of revisions, or an empty array if none.
int $post_id The ID of the post to save as a revision.

Usage Examples

Basic Usage
<?php
// Hook into wp_save_post_revision_revisions_before_deletion
add_filter('wp_save_post_revision_revisions_before_deletion', 'my_custom_filter', 10, 2);

function my_custom_filter($revisions, $post_id) {
    // Your custom filtering logic here
    return $revisions;
}

Source Code Context

wp-includes/revision.php:239 - How this hook is used in WordPress core
<?php
 234  	 * @since 6.2.0
 235  	 *
 236  	 * @param WP_Post[] $revisions Array of revisions, or an empty array if none.
 237  	 * @param int       $post_id   The ID of the post to save as a revision.
 238  	 */
 239  	$revisions = apply_filters(
 240  		'wp_save_post_revision_revisions_before_deletion',
 241  		$revisions,
 242  		$post_id
 243  	);
 244  

PHP Documentation

<?php
/**
	 * Filters the revisions to be considered for deletion.
	 *
	 * @since 6.2.0
	 *
	 * @param WP_Post[] $revisions Array of revisions, or an empty array if none.
	 * @param int       $post_id   The ID of the post to save as a revision.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/revision.php
Related Hooks

Related hooks will be displayed here in future updates.