Retrieves a single font face within the parent font family.
Parameters
$request
WP_REST_Requestrequired- Full details about the request.
Source
public function get_item( $request ) {
$post = $this->get_post( $request['id'] );
if ( is_wp_error( $post ) ) {
return $post;
}
// Check that the font face has a valid parent font family.
$font_family = $this->get_parent_font_family_post( $request['font_family_id'] );
if ( is_wp_error( $font_family ) ) {
return $font_family;
}
if ( (int) $font_family->ID !== (int) $post->post_parent ) {
return new WP_Error(
'rest_font_face_parent_id_mismatch',
/* translators: %d: A post id. */
sprintf( __( 'The font face does not belong to the specified font family with id of "%d".' ), $font_family->ID ),
array( 'status' => 404 )
);
}
return parent::get_item( $request );
}
Changelog
Version | Description |
---|---|
6.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.