post_(field)
Filters the value of a specific post field for display.
Only applied to post fields name which is not prefixed with post_.
The dynamic portion of the hook name, $field, refers to the post field name. Possible filter names include:
- post_ID
- post_comment_status
- post_ping_status
- post_to_ping
- post_pinged
- post_guid
- post_menu_order
- post_comment_count
Usage
add_filter( 'post_(field)', 'wp_kama_post_field_filter', 10, 3 ); /** * Function for `post_(field)` filter-hook. * * @param mixed $value Value of the unprefixed 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(mixed)
- Value of the unprefixed post field.
- $post_id(int)
- Post ID
- $context(string)
- Context for how to sanitize the field. Accepts 'raw', 'edit', 'db', 'display', 'attribute', or 'js'.
Default: 'display'
Changelog
Since 2.3.0 | Introduced. |
Where the hook is called
post_(field)
wp-includes/post.php 3164
$value = apply_filters( "post_{$field}", $value, $post_id, $context );
Where the hook is used in WordPress
wp-admin/includes/admin-filters.php 168
add_action( 'post_updated', array( 'WP_Privacy_Policy_Content', '_policy_page_updated' ) );
wp-includes/default-filters.php 107
add_filter( 'post_mime_type', 'sanitize_mime_type' );
wp-includes/default-filters.php 419
add_action( 'post_updated', 'wp_save_post_revision', 10, 1 );
wp-includes/default-filters.php 456
add_action( 'post_updated', 'wp_check_for_changed_slugs', 12, 3 );
wp-includes/default-filters.php 460
add_action( 'post_updated', 'wp_check_for_changed_dates', 12, 3 );
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 1780
add_filter( 'post_password_required', '__return_false' );
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 1792
remove_filter( 'post_password_required', '__return_false' );
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 1920
add_filter( 'post_password_required', array( $this, 'check_password_required' ), 10, 2 );
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 1979
remove_filter( 'post_password_required', array( $this, 'check_password_required' ) );
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 434
add_filter( 'post_password_required', array( $this, 'check_password_required' ), 10, 2 );
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 457
remove_filter( 'post_password_required', array( $this, 'check_password_required' ) );
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 573
add_filter( 'post_password_required', array( $this, 'check_password_required' ), 10, 2 );