Skip to content

Commit

Permalink
Restore default rendering mode for Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Jan 15, 2025
1 parent 523b32c commit ef0b732
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/compat/wordpress-6.8/post.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

/**
* Set the default editor mode for the page post type to `template-locked`.
*
* Note: This backports into `create_initial_post_types` in WordPress Core.
*
* @param array $args Array of post type arguments.
* @return array Updated array of post type arguments.
*/
function gutenberg_update_page_editor_support( $args ) {
if ( empty( $args['supports'] ) ) {
return $args;
}

$editor_support_key = array_search( 'editor', $args['supports'], true );
if ( false !== $editor_support_key ) {
unset( $args['supports'][ $editor_support_key ] );
$args['supports']['editor'] = array(
'default_mode' => 'template-locked',
);
}

return $args;
}
add_action( 'register_page_post_type_args', 'gutenberg_update_page_editor_support' );
1 change: 1 addition & 0 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-6.8/preload.php';
require __DIR__ . '/compat/wordpress-6.8/blocks.php';
require __DIR__ . '/compat/wordpress-6.8/functions.php';
require __DIR__ . '/compat/wordpress-6.8/post.php';
require __DIR__ . '/compat/wordpress-6.8/site-editor.php';
require __DIR__ . '/compat/wordpress-6.8/class-gutenberg-rest-user-controller.php';

Expand Down

0 comments on commit ef0b732

Please sign in to comment.