WC_Register_WP_Admin_Settings::register │ public │ WC 11.2.0

Attaches the filters that expose the wrapped object's settings to the Settings REST API.

Called from the constructor; safe to call again to re-attach after hook state has been reset. Repeat calls re-add the same callbacks, which WordPress stores under the same identifiers, so they never duplicate registered groups or settings.

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

Хуков нет.

Возвращает

void. Ничего (null).

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

$WC_Register_WP_Admin_Settings = new WC_Register_WP_Admin_Settings();
$WC_Register_WP_Admin_Settings->register();

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

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

Код WC_Register_WP_Admin_Settings::register() WC 11.3.0

public function register() {
	if ( 'page' === $this->type ) {
		/**
		 * A settings page (or an object with a compatible shape).
		 *
		 * @var WC_Settings_Page $page
		 */
		$page = $this->object;
		add_filter( 'woocommerce_settings_groups', array( $this, 'register_page_group' ) );
		add_filter( 'woocommerce_settings-' . $page->get_id(), array( $this, 'register_page_settings' ) );
	} elseif ( 'email' === $this->type ) {
		/**
		 * An email (or an object with a compatible shape).
		 *
		 * @var WC_Email $email
		 */
		$email = $this->object;
		add_filter( 'woocommerce_settings_groups', array( $this, 'register_email_group' ) );
		add_filter( 'woocommerce_settings-email_' . $email->id, array( $this, 'register_email_settings' ) );
	}
}