From f4721b1d3193c130492d5a37c5cf69192fd89596 Mon Sep 17 00:00:00 2001 From: Tyler Bailey Date: Fri, 2 Aug 2024 15:02:56 -0400 Subject: [PATCH] Adjust order of rendering_mode filters --- .../class-wp-rest-post-types-controller.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php index e5e243a79907f..a660e2f2dd301 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php @@ -259,26 +259,27 @@ public function prepare_item_for_response( $item, $request ) { // Editor rendering mode. if ( wp_is_block_theme() && 'edit' === $context && property_exists( $post_type, 'default_rendering_mode' ) ) { /** - * Filters the block editor rendering mode for a specific post type. - * - * The dynamic portion of the hook name, `$item->name`, refers to the post type slug. + * Filters the block editor rendering mode for a post type. * * @since 6.7.0 * @param string $default_rendering_mode Default rendering mode for the post type. - * @param WP_Post_Type $post_type Post type object. + * @param WP_Post_Type $post_type Post type name. * @return string Default rendering mode for the post type. */ - $rendering_mode = apply_filters( "post_type_{$post_type->name}_default_rendering_mode", $post_type->default_rendering_mode, $post_type ); + $rendering_mode = apply_filters( 'post_type_default_rendering_mode', $post_type->default_rendering_mode, $post_type ); /** - * Filters the block editor rendering mode for a post type. + * Filters the block editor rendering mode for a specific post type. + * Applied after the `post_type_default_rendering_mode` filter. + * + * The dynamic portion of the hook name, `$item->name`, refers to the post type slug. * * @since 6.7.0 * @param string $default_rendering_mode Default rendering mode for the post type. - * @param WP_Post_Type $post_type Post type name. + * @param WP_Post_Type $post_type Post type object. * @return string Default rendering mode for the post type. */ - $rendering_mode = apply_filters( 'post_type_default_rendering_mode', $rendering_mode, $post_type ); + $rendering_mode = apply_filters( "post_type_{$post_type->name}_default_rendering_mode", $rendering_mode, $post_type ); // Validate the filtered rendering mode. if ( ! in_array( $rendering_mode, get_post_type_rendering_modes(), true ) ) {