diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php index ec1588b02f..a29f92c56f 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php @@ -1998,6 +1998,10 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { $data['generated_slug'] = $sample_permalink[1]; } } + + if ( rest_is_field_included( 'class_list', $fields ) ) { + $data['class_list'] = get_post_class( array(), $post->ID ); + } } $context = ! empty( $request['context'] ) ? $request['context'] : 'view'; @@ -2353,6 +2357,16 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { 'context' => array( 'edit' ), 'readonly' => true, ); + + $schema['properties']['class_list'] = array( + 'description' => __( 'An array of the class names for the post container element.' ), + 'type' => 'array', + 'context' => array( 'view', 'edit' ), + 'readonly' => true, + 'items' => array( + 'type' => 'string', + ), + ); } if ( $post_type_obj->hierarchical ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 6599f6a9bc..967df0cbe5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.6-alpha-58325'; +$wp_version = '6.6-alpha-58326'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.