Posts, Post Types: Ensure get_post_class() returns a list.

This avoids the REST API erroneously returning an object in the `class_list` property returned by `WP_REST_Posts_Controller::prepare_item_for_response()`.

Developed in https://github.com/WordPress/wordpress-develop/pull/10515

Props dlh, mamaduka, westonruter.
Fixes #64247.

Built from https://develop.svn.wordpress.org/trunk@61269


git-svn-id: http://core.svn.wordpress.org/trunk@60581 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2025-11-19 06:03:30 +00:00
parent e8d1cb9adc
commit 32de466672
2 changed files with 5 additions and 2 deletions

View File

@ -606,7 +606,10 @@ function get_post_class( $css_class = '', $post = null ) {
*/
$classes = apply_filters( 'post_class', $classes, $css_class, $post->ID );
return array_unique( $classes );
$classes = array_unique( $classes );
$classes = array_values( $classes );
return $classes;
}
/**

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '7.0-alpha-61268';
$wp_version = '7.0-alpha-61269';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.