mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
REST API: Add post class list field.
See https://github.com/WordPress/gutenberg/pull/60642. See https://github.com/WordPress/wordpress-develop/pull/6716. Fixes #61360. Props antonvlasenko, timothyblynjacobs, ellatrix, oandregal. Built from https://develop.svn.wordpress.org/trunk@58326 git-svn-id: http://core.svn.wordpress.org/trunk@57783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
387a7a8ffd
commit
10642d626d
@ -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 ) {
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user