Get the parent font family, if the ID is valid.
Parameters
$font_family_id
intrequired- Supplied ID.
Source
protected function get_parent_font_family_post( $font_family_id ) {
$error = new WP_Error(
'rest_post_invalid_parent',
__( 'Invalid post parent ID.', 'default' ),
array( 'status' => 404 )
);
if ( (int) $font_family_id <= 0 ) {
return $error;
}
$font_family_post = get_post( (int) $font_family_id );
if ( empty( $font_family_post ) || empty( $font_family_post->ID )
|| 'wp_font_family' !== $font_family_post->post_type
) {
return $error;
}
return $font_family_post;
}
Changelog
Version | Description |
---|---|
6.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.