Skip to content

Commit

Permalink
Adjust order of rendering_mode filters
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerB24890 committed Aug 2, 2024
1 parent 1166581 commit f4721b1
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) {
Expand Down

0 comments on commit f4721b1

Please sign in to comment.