Skip to content

Instantly share code, notes, and snippets.

@kimsible
Last active September 15, 2020 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimsible/0187510ccfe48d219518208127a33d15 to your computer and use it in GitHub Desktop.
Save kimsible/0187510ccfe48d219518208127a33d15 to your computer and use it in GitHub Desktop.
WordPress - Snippet - Disable content editor for specific pages
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