Automattic\WooCommerce\Internal\Font

FontFace::get_installed_font_faces_by_slug()public staticWC 1.0

Gets the installed font face by slug.

Method of the class: FontFace{}

No Hooks.

Return

\WP_Post|null. The font face post or null if not found.

Usage

$result = FontFace::get_installed_font_faces_by_slug( $slug );
$slug(string) (required)
The font face slug.

FontFace::get_installed_font_faces_by_slug() code WC 9.5.1

public static function get_installed_font_faces_by_slug( $slug ) {
	$query = new \WP_Query(
		array(
			'post_type'              => self::POST_TYPE,
			'update_post_meta_cache' => false,
			'update_post_term_cache' => false,
			'name'                   => $slug,
		)
	);

	if ( ! empty( $query->get_posts() ) ) {
		return $query->get_posts()[0];
	}
	return null;
}