Title: WP_REST_Font_Faces_Controller::get_settings_from_post
Published: April 3, 2024
Last modified: April 28, 2025

---

# WP_REST_Font_Faces_Controller::get_settings_from_post( WP_Post $post ): array

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_rest_font_faces_controller/get_settings_from_post/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_rest_font_faces_controller/get_settings_from_post/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_font_faces_controller/get_settings_from_post/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rest_font_faces_controller/get_settings_from_post/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_font_faces_controller/get_settings_from_post/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_rest_font_faces_controller/get_settings_from_post/?output_format=md#wp--skip-link--target)

Gets the font face’s settings from the post.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_rest_font_faces_controller/get_settings_from_post/?output_format=md#parameters)󠁿

 `$post`[WP_Post](https://developer.wordpress.org/reference/classes/wp_post/)required

Font face post object.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rest_font_faces_controller/get_settings_from_post/?output_format=md#return)󠁿

 array Font face settings array.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_font_faces_controller/get_settings_from_post/?output_format=md#source)󠁿

    ```php
    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 );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/endpoints/class-wp-rest-font-faces-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/rest-api/endpoints/class-wp-rest-font-faces-controller.php#L935)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/rest-api/endpoints/class-wp-rest-font-faces-controller.php#L935-L949)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rest_font_faces_controller/get_settings_from_post/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_REST_Font_Faces_Controller::get_item_schema()](https://developer.wordpress.org/reference/classes/wp_rest_font_faces_controller/get_item_schema/)`wp-includes/rest-api/endpoints/class-wp-rest-font-faces-controller.php` |

Retrieves the post’s schema, conforming to JSON Schema.

  |

| Used by | Description | 
| [WP_REST_Font_Faces_Controller::prepare_item_for_response()](https://developer.wordpress.org/reference/classes/wp_rest_font_faces_controller/prepare_item_for_response/)`wp-includes/rest-api/endpoints/class-wp-rest-font-faces-controller.php` |

Prepares a single font face output for response.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_font_faces_controller/get_settings_from_post/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.5.0](https://developer.wordpress.org/reference/since/6.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_font_faces_controller%2Fget_settings_from_post%2F)
before being able to contribute a note or feedback.