WordPress at a glance
function is not described

WC_REST_Setting_Options_V2_Controller::filter_setting() public WC 3.0.0

Filters out bad values from the settings array/filter so we only return known values via the API.

{} It's a method of the class: WC_REST_Setting_Options_V2_Controller{}

No Hooks.

Return

Array.

Usage

$WC_REST_Setting_Options_V2_Controller = new WC_REST_Setting_Options_V2_Controller();
$WC_REST_Setting_Options_V2_Controller->filter_setting( $setting );
$setting(array) (required)
Settings.

Changelog

Since 3.0.0 Introduced.

Code of WC_REST_Setting_Options_V2_Controller::filter_setting() WC 5.0.0

<?php
public function filter_setting( $setting ) {
	$setting = array_intersect_key(
		$setting,
		array_flip( array_filter( array_keys( $setting ), array( $this, 'allowed_setting_keys' ) ) )
	);

	if ( empty( $setting['options'] ) ) {
		unset( $setting['options'] );
	}

	if ( 'image_width' === $setting['type'] ) {
		$setting = $this->cast_image_width( $setting );
	}

	return $setting;
}