get_registered_settings(): array

In this article

Retrieves an array of registered settings.

Return

array List of registered settings, keyed by option name.
  • ...$0 array
    Data used to describe the setting when registered.
    • type string
      The type of data associated with this setting.
      Valid values are 'string', 'boolean', 'integer', 'number', 'array', and 'object'.
    • label string
      A label of the data attached to this setting.
    • description string
      A description of the data attached to this setting.
    • sanitize_callback callable
      A callback function that sanitizes the option’s value.
    • show_in_rest bool|array
      Whether data associated with this setting should be included in the REST API.
      When registering complex settings, this argument may optionally be an array with a 'schema' key.
    • default mixed
      Default value when calling get_option().

Source

function get_registered_settings() {
	global $wp_registered_settings;

	if ( ! is_array( $wp_registered_settings ) ) {
		return array();
	}

	return $wp_registered_settings;
}

Changelog

VersionDescription
4.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.