WP_REST_Font_Faces_Controller::get_settings_from_post()
Gets the font face's settings from the post.
Method of the class: WP_REST_Font_Faces_Controller{}
No Hooks.
Return
Array
. Font face settings array.
Usage
// protected - for code of main (parent) or child class $result = $this->get_settings_from_post( $post );
- $post(WP_Post) (required)
- Font face post object.
Changelog
Since 6.5.0 | Introduced. |
WP_REST_Font_Faces_Controller::get_settings_from_post() WP REST Font Faces Controller::get settings from post code WP 6.6.2
protected function get_settings_from_post( $post ) { $settings = json_decode( $post->post_content, true ); $properties = $this->get_item_schema()['properties']['font_face_settings']['properties']; // Provide required, empty settings if needed. if ( null === $settings ) { $settings = array( 'fontFamily' => '', 'src' => array(), ); } // Only return the properties defined in the schema. return array_intersect_key( $settings, $properties ); }