Skip to content

Commit 1db27f9

Browse files
committed
Adjust order of rendering_mode filters
1 parent dfc5d7e commit 1db27f9

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,26 +259,27 @@ public function prepare_item_for_response( $item, $request ) {
259259
// Editor rendering mode.
260260
if ( wp_is_block_theme() && 'edit' === $context && property_exists( $post_type, 'default_rendering_mode' ) ) {
261261
/**
262-
* Filters the block editor rendering mode for a specific post type.
263-
*
264-
* The dynamic portion of the hook name, `$item->name`, refers to the post type slug.
262+
* Filters the block editor rendering mode for a post type.
265263
*
266264
* @since 6.7.0
267265
* @param string $default_rendering_mode Default rendering mode for the post type.
268-
* @param WP_Post_Type $post_type Post type object.
266+
* @param WP_Post_Type $post_type Post type name.
269267
* @return string Default rendering mode for the post type.
270268
*/
271-
$rendering_mode = apply_filters( "post_type_{$post_type->name}_default_rendering_mode", $post_type->default_rendering_mode, $post_type );
269+
$rendering_mode = apply_filters( 'post_type_default_rendering_mode', $post_type->default_rendering_mode, $post_type );
272270

273271
/**
274-
* Filters the block editor rendering mode for a post type.
272+
* Filters the block editor rendering mode for a specific post type.
273+
* Applied after the `post_type_default_rendering_mode` filter.
274+
*
275+
* The dynamic portion of the hook name, `$item->name`, refers to the post type slug.
275276
*
276277
* @since 6.7.0
277278
* @param string $default_rendering_mode Default rendering mode for the post type.
278-
* @param WP_Post_Type $post_type Post type name.
279+
* @param WP_Post_Type $post_type Post type object.
279280
* @return string Default rendering mode for the post type.
280281
*/
281-
$rendering_mode = apply_filters( 'post_type_default_rendering_mode', $rendering_mode, $post_type );
282+
$rendering_mode = apply_filters( "post_type_{$post_type->name}_default_rendering_mode", $rendering_mode, $post_type );
282283

283284
// Validate the filtered rendering mode.
284285
if ( ! in_array( $rendering_mode, get_post_type_rendering_modes(), true ) ) {

0 commit comments

Comments
 (0)