Created
March 21, 2026 04:37
-
-
Save loorlab/b20d9dfb987b4a3b634b795d580db2af to your computer and use it in GitHub Desktop.
Disable the Block Editor (Gutenberg) ONLY on the Home Page - WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Desactivar el Editor de Bloques (Gutenberg) SOLO en la Página de Inicio | |
| * functions.php | |
| */ | |
| add_filter('use_block_editor_for_post', 'disable_gutenberg_for_homepage', 10, 2); | |
| function disable_gutenberg_for_homepage($is_use_block_editor, $post) { | |
| // Obtenemos el ID de la página configurada como "Inicio" en los ajustes de lectura | |
| $front_page_id = (int) get_option('page_on_front'); | |
| // Si el post actual es la página de inicio, apagamos Gutenberg | |
| if ($post->ID === $front_page_id) { | |
| return false; | |
| } | |
| // Para el resto del sitio, lo dejamos como estaba | |
| return $is_use_block_editor; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment