Automattic\WooCommerce\Internal\Font
FontFace::get_installed_font_faces_by_slug
Gets the installed font face by slug.
Method of the class: FontFace{}
No Hooks.
Returns
\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() FontFace::get installed font faces by slug code WC 10.3.5
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;
}