content_save_pre
Filters the value of a specific field before saving.
Only applied to post fields with a name which is prefixed with post_.
- author_save_pre
- date_save_pre
- date_gmt_save_pre
- content_save_pre
- title_save_pre
- excerpt_save_pre
- status_save_pre
- password_save_pre
- name_save_pre
- modified_save_pre
- modified_gmt_save_pre
- content_filtered_save_pre
- parent_save_pre
- type_save_pre
- mime_type_save_pre
This is one of the variants of the dynamic hook (field_no_prefix)_save_pre
Usage
add_filter( 'content_save_pre', 'wp_kama_content_save_pre_filter' );
/**
* Function for `content_save_pre` filter-hook.
*
* @param mixed $value Value of the post field.
*
* @return mixed
*/
function wp_kama_content_save_pre_filter( $value ){
// filter...
return $value;
}
- $value(mixed)
- Value of the post field.
Changelog
| Since 2.3.0 | Introduced. |
Where the hook is called
content_save_pre
wp-includes/post.php 3101
$value = apply_filters( "{$field_no_prefix}_save_pre", $value );
wp-includes/customize/class-wp-customize-nav-menu-item-setting.php 734
$menu_item_value['description'] = wp_unslash( apply_filters( 'content_save_pre', wp_slash( $menu_item_value['description'] ) ) );
Where the hook is used in WordPress
wp-includes/default-filters.php 157
add_filter( $filter, 'convert_invalid_entities' );
wp-includes/default-filters.php 158
add_filter( $filter, 'balanceTags', 50 );
wp-includes/kses.php 2289
add_filter( 'content_save_pre', 'wp_filter_global_styles_post', 9 );
wp-includes/kses.php 2293
add_filter( 'content_save_pre', 'wp_filter_post_kses' );
wp-includes/kses.php 2319
remove_filter( 'content_save_pre', 'wp_filter_global_styles_post', 9 );
wp-includes/kses.php 2323
remove_filter( 'content_save_pre', 'wp_filter_post_kses' );