title_save_pre
Filter HookDescription
Sanitize an input. Note that parent::sanitize() erroneously does wp_unslash() on $value, but we remove that in this override. Otherwise the sanitized value.Hook Information
File Location |
wp-includes/customize/class-wp-customize-nav-menu-item-setting.php
View on GitHub
|
Hook Type | Filter |
Line Number | 719 |
Hook Parameters
Type | Name | Description |
---|---|---|
array
|
$value
|
The menu item value to sanitize. |
Usage Examples
Basic Usage
<?php
// Hook into title_save_pre
add_filter('title_save_pre', 'my_custom_filter', 10, 1);
function my_custom_filter($value) {
// Your custom filtering logic here
return $value;
}
Source Code Context
wp-includes/customize/class-wp-customize-nav-menu-item-setting.php:719
- How this hook is used in WordPress core
<?php
714 $menu_item_value['original_title'] = sanitize_text_field( $menu_item_value['original_title'] );
715
716 // Apply the same filters as when calling wp_insert_post().
717
718 /** This filter is documented in wp-includes/post.php */
719 $menu_item_value['title'] = wp_unslash( apply_filters( 'title_save_pre', wp_slash( $menu_item_value['title'] ) ) );
720
721 /** This filter is documented in wp-includes/post.php */
722 $menu_item_value['attr_title'] = wp_unslash( apply_filters( 'excerpt_save_pre', wp_slash( $menu_item_value['attr_title'] ) ) );
723
724 /** This filter is documented in wp-includes/post.php */
PHP Documentation
<?php
/**
* Sanitize an input.
*
* Note that parent::sanitize() erroneously does wp_unslash() on $value, but
* we remove that in this override.
*
* @since 4.3.0
* @since 5.9.0 Renamed `$menu_item_value` to `$value` for PHP 8 named parameter support.
*
* @param array $value The menu item value to sanitize.
* @return array|false|null|WP_Error Null or WP_Error if an input isn't valid. False if it is marked for deletion.
* Otherwise the sanitized value.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/customize/class-wp-customize-nav-menu-item-setting.php
Related Hooks
Related hooks will be displayed here in future updates.