WP_Font_Collection::get_data(): array|WP_Error

In this article

Retrieves the font collection data.

Return

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

Source

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 );
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

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