_wp_post_revision_field_(field) хук-фильтрWP 3.6.0

Contextually filter a post revision field.

The dynamic portion of the hook name, $field, corresponds to a name of a field of the revision object.

Possible hook names include:

  • _wp_post_revision_field_post_title
  • _wp_post_revision_field_post_content
  • _wp_post_revision_field_post_excerpt

Использование

add_filter( '_wp_post_revision_field_(field)', 'wp_kama__wp_post_revision_field_filter', 10, 4 );

/**
 * Function for `_wp_post_revision_field_(field)` filter-hook.
 * 
 * @param string  $revision_field The current revision field to compare to or from.
 * @param string  $field          The current revision field.
 * @param WP_Post $compare_from   The revision post object to compare to or from.
 * @param string  $context        The context of whether the current revision is the old or the new one. Values are 'to' or 'from'.
 *
 * @return string
 */
function wp_kama__wp_post_revision_field_filter( $revision_field, $field, $compare_from, $context ){

	// filter...
	return $revision_field;
}
$revision_field(строка)
The current revision field to compare to or from.
$field(строка)
The current revision field.
$compare_from(WP_Post)
The revision post object to compare to or from.
$context(строка)
The context of whether the current revision is the old or the new one. Values are 'to' or 'from'.

Список изменений

С версии 3.6.0 Введена.

Где вызывается хук

wp_get_revision_ui_diff()
_wp_post_revision_field_(field)
wp-admin/includes/revision.php 88
$content_from = $compare_from ? apply_filters( "_wp_post_revision_field_{$field}", $compare_from->$field, $field, $compare_from, 'from' ) : '';
wp-admin/includes/revision.php 91
$content_to = apply_filters( "_wp_post_revision_field_{$field}", $compare_to->$field, $field, $compare_to, 'to' );

Где используется хук в WordPress

Использование не найдено.