Created
May 18, 2017 17:56
-
-
Save alexwcoleman/6d4cdfe318641d56eab318bace4c2bf9 to your computer and use it in GitHub Desktop.
Remove the WordPress text editor on 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
/** | |
* Hide editor on specific pages. | |
* | |
*/ | |
// admin_init fires too late (I think...), so admin_head it is | |
add_action( 'admin_head', 'hide_text_editor' ); | |
function hide_text_editor() { | |
$post_id = get_the_ID(); | |
// some admin pages have no ID. Bugger off if there isn't an ID. | |
if( !isset( $post_id ) ) return; | |
// Hide the editor on the page titled 'Home' | |
// You could also do this for IDs. | |
$pagename = get_the_title($post_id); | |
if($pagename == 'Home'){ | |
remove_post_type_support('page', 'editor'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment