WP_Font_Collection::get_datapublicWP 6.5.0

Retrieves the font collection data.

Method of the class: WP_Font_Collection{}

No Hooks.

Returns

Array|WP_Error. An array containing the font collection data, or a WP_Error on failure.

Usage

$WP_Font_Collection = new WP_Font_Collection();
$WP_Font_Collection->get_data();

Changelog

Since 6.5.0 Introduced.

WP_Font_Collection::get_data() code WP 6.8.1

public function get_data() {
	if ( is_wp_error( $this->data ) ) {
		return $this->data;
	}

	// If the collection uses JSON data, load it and cache the data/error.
	if ( isset( $this->src ) ) {
		$this->data = $this->load_from_json( $this->src );
	}

	if ( is_wp_error( $this->data ) ) {
		return $this->data;
	}

	// Set defaults for optional properties.
	$defaults = array(
		'description' => '',
		'categories'  => array(),
	);

	return wp_parse_args( $this->data, $defaults );
}