post_(field)
Filters the value of a specific post field for display.
The dynamic portion of the hook name, $field, refers to the post field name.
Использование
add_filter( 'post_(field)', 'wp_kama_post_field_filter', 10, 3 ); /** * Function for `post_(field)` filter-hook. * * @param mixed $value Value of the prefixed post field. * @param int $post_id Post ID. * @param string $context Context for how to sanitize the field. Accepts 'raw', 'edit', 'db', 'display', 'attribute', or 'js'. * * @return mixed */ function wp_kama_post_field_filter( $value, $post_id, $context ){ // filter... return $value; }
- $value(разное)
- Value of the prefixed post field.
- $post_id(int)
- Post ID.
- $context(строка)
- Context for how to sanitize the field. Accepts 'raw', 'edit', 'db', 'display', 'attribute', or 'js'.
По умолчанию: 'display'
Список изменений
С версии 2.3.0 | Введена. |
Где вызывается хук
post_(field)
wp-includes/post.php 2873
$value = apply_filters( "post_{$field}", $value, $post_id, $context );
Где используется хук в WordPress
wp-admin/includes/admin-filters.php 167
add_action( 'post_updated', array( 'WP_Privacy_Policy_Content', '_policy_page_updated' ) );
wp-includes/default-filters.php 101
add_filter( 'post_mime_type', 'sanitize_mime_type' );
wp-includes/default-filters.php 411
add_action( 'post_updated', 'wp_save_post_revision', 10, 1 );
wp-includes/default-filters.php 446
add_action( 'post_updated', 'wp_check_for_changed_slugs', 12, 3 );
wp-includes/default-filters.php 450
add_action( 'post_updated', 'wp_check_for_changed_dates', 12, 3 );
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 1776
add_filter( 'post_password_required', '__return_false' );
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 1788
remove_filter( 'post_password_required', '__return_false' );
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 1847
add_filter( 'post_password_required', array( $this, 'check_password_required' ), 10, 2 );
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 1885
remove_filter( 'post_password_required', array( $this, 'check_password_required' ) );
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 368
add_filter( 'post_password_required', array( $this, 'check_password_required' ), 10, 2 );
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 391
remove_filter( 'post_password_required', array( $this, 'check_password_required' ) );
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 507
add_filter( 'post_password_required', array( $this, 'check_password_required' ), 10, 2 );