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

WC_Register_WP_Admin_Settings::register_setting() public WC 3.0.0

Register a setting into the format expected for the Settings REST API.

{} Это метод класса: WC_Register_WP_Admin_Settings{}

Хуков нет.

Возвращает

Массив|true|false.

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

$WC_Register_WP_Admin_Settings = new WC_Register_WP_Admin_Settings();
$WC_Register_WP_Admin_Settings->register_setting( $setting );
$setting(массив) (обязательный)
Setting data.

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

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

Код WC_Register_WP_Admin_Settings::register_setting() WC 5.6.0

public function register_setting( $setting ) {
	if ( ! isset( $setting['id'] ) ) {
		return false;
	}

	$description = '';
	if ( ! empty( $setting['desc'] ) ) {
		$description = $setting['desc'];
	} elseif ( ! empty( $setting['description'] ) ) {
		$description = $setting['description'];
	}

	$new_setting = array(
		'id'          => $setting['id'],
		'label'       => ( ! empty( $setting['title'] ) ? $setting['title'] : '' ),
		'description' => $description,
		'type'        => $setting['type'],
		'option_key'  => $setting['option_key'],
	);

	if ( isset( $setting['default'] ) ) {
		$new_setting['default'] = $setting['default'];
	}
	if ( isset( $setting['options'] ) ) {
		$new_setting['options'] = $setting['options'];
	}
	if ( isset( $setting['desc_tip'] ) ) {
		if ( true === $setting['desc_tip'] ) {
			$new_setting['tip'] = $description;
		} elseif ( ! empty( $setting['desc_tip'] ) ) {
			$new_setting['tip'] = $setting['desc_tip'];
		}
	}

	return $new_setting;
}