Created
December 5, 2022 09:46
-
-
Save AndreFCAmorim/fa12cb7f0bd1003e7aa16986e10466f3 to your computer and use it in GitHub Desktop.
Hide WP Editor on Page Templates
This file contains 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 | |
add_action( 'admin_init', 'hide_editor' ); | |
function hide_editor() { | |
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ; | |
if( !isset( $post_id ) ) { | |
return; | |
} | |
$template_file = get_post_meta($post_id, '_wp_page_template', true); | |
switch ( $template_file ) { | |
case 'name_of_page_template_file.php': | |
remove_post_type_support('page', 'editor'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment