Last active
September 15, 2020 11:36
-
-
Save kimsible/0187510ccfe48d219518208127a33d15 to your computer and use it in GitHub Desktop.
WordPress - Snippet - Disable content editor for specific pages
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
function disable_content_editor () { | |
$pages_ids = array(2); // add your page / post id here | |
if ($_GET['post']) { | |
$post_id = $_GET['post']; | |
} else { | |
$post_id = $_POST['post_ID']; | |
} | |
if (!isset($post_id)) return; | |
foreach ($pages_ids as $page_id) { | |
if ($post_id == $page_id && 'edit' == $_GET['action']) { | |
remove_post_type_support('page', 'editor'); | |
} | |
} | |
} | |
add_action('admin_init', 'disable_content_editor'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment