WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Customize_Nav_Menu_Setting::sanitize() WP 4.3.0

Sanitize an input.

Note that parent::sanitize() erroneously does wp_unslash() on $value, but we remove that in this override.

Это метод класса: WP_Customize_Nav_Menu_Setting

Хуки из метода
Возвращает

Массив/false/null. Null if an input isn't valid. False if it is marked for deletion. Otherwise the sanitized value.

Использование

$WP_Customize_Nav_Menu_Setting = new WP_Customize_Nav_Menu_Setting();
$var = $WP_Customize_Nav_Menu_Setting->sanitize( $value );
$value(массив) (обязательный)
The value to sanitize.

Список изменений

С версии 4.3.0 Введена.

Код WP Customize Nav Menu Setting::sanitize: wp-includes/customize/class-wp-customize-nav-menu-setting.php WP 5.2.4

<?php
public function sanitize( $value ) {
	// Menu is marked for deletion.
	if ( false === $value ) {
		return $value;
	}

	// Invalid.
	if ( ! is_array( $value ) ) {
		return null;
	}

	$default = array(
		'name'        => '',
		'description' => '',
		'parent'      => 0,
		'auto_add'    => false,
	);
	$value   = array_merge( $default, $value );
	$value   = wp_array_slice_assoc( $value, array_keys( $default ) );

	$value['name']        = trim( esc_html( $value['name'] ) ); // This sanitization code is used in wp-admin/nav-menus.php.
	$value['description'] = sanitize_text_field( $value['description'] );
	$value['parent']      = max( 0, intval( $value['parent'] ) );
	$value['auto_add']    = ! empty( $value['auto_add'] );

	if ( '' === $value['name'] ) {
		$value['name'] = _x( '(unnamed)', 'Missing menu name.' );
	}

	/** This filter is documented in wp-includes/class-wp-customize-setting.php */
	return apply_filters( "customize_sanitize_{$this->id}", $value, $this );
}