Adds a small custom REST field to posts so front ends can read the site name without making a second settings request.
add_action( 'rest_api_init', 'wpfolks_register_post_site_name_field' );
function wpfolks_register_post_site_name_field() {
register_rest_field( 'post', 'site_name', array(
'get_callback' => static function () {
return get_bloginfo( 'name' );
},
'schema' => array(
'type' => 'string',
),
) );
}