pre_post_{$field}
Filter HookDescription
Filters the value of a specific field before saving. Only applied to post fields with a name which is prefixed with `post_`. The dynamic portion of the hook name, `$field_no_prefix`, refers to the post field name minus the `post_` prefix. Possible filter names include: - `pre_post_ID` - `pre_post_comment_status` - `pre_post_ping_status` - `pre_post_to_ping` - `pre_post_pinged` - `pre_post_guid` - `pre_post_menu_order` - `pre_post_comment_count`Hook Information
File Location |
wp-includes/post.php
View on GitHub
|
Hook Type | Filter |
Line Number | 3124 |
Hook Parameters
Type | Name | Description |
---|---|---|
mixed
|
$value
|
Value of the post field. |
Usage Examples
Basic Usage
<?php
// Hook into pre_post_{$field}
add_filter('pre_post_{$field}', 'my_custom_filter', 10, 1);
function my_custom_filter($value) {
// Your custom filtering logic here
return $value;
}
Source Code Context
wp-includes/post.php:3124
- How this hook is used in WordPress core
<?php
3119 *
3120 * @since 2.3.0
3121 *
3122 * @param mixed $value Value of the post field.
3123 */
3124 $value = apply_filters( "pre_post_{$field}", $value );
3125
3126 /**
3127 * Filters the value of a specific post field before saving.
3128 *
3129 * Only applied to post fields with a name which is *not* prefixed with `post_`.
PHP Documentation
<?php
/**
* Filters the value of a specific field before saving.
*
* Only applied to post fields with a name which is prefixed with `post_`.
*
* The dynamic portion of the hook name, `$field_no_prefix`, refers to the
* post field name minus the `post_` prefix. Possible filter names include:
*
* - `pre_post_ID`
* - `pre_post_comment_status`
* - `pre_post_ping_status`
* - `pre_post_to_ping`
* - `pre_post_pinged`
* - `pre_post_guid`
* - `pre_post_menu_order`
* - `pre_post_comment_count`
*
* @since 2.3.0
*
* @param mixed $value Value of the post field.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/post.php
Related Hooks
Related hooks will be displayed here in future updates.