WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How does one apply an action to one particular page within admin?

I've added a bunch of wysiwyg editors to one page ("Home") and now I don't need the main editor. But the function below - of course - removes the editor from all pages:

function remove_editor_from_home_page() {

  remove_post_type_support( 'page', 'editor' );

add_action( 'init', 'remove_editor_from_home_page' );

How can I target the Home page within admin by name - "Home" - or by page_id?

This other WPSE answer doesn't want to work for me: Target a certain page within wordpress backend

share|improve this question
up vote 3 down vote accepted
add_action( 'add_meta_boxes_page', 'wpse_57924_remove_editor' );
function wpse_57924_remove_editor( $post )
    if ( $post->ID == get_option( 'page_on_front' ) /* or hardcode ID if not front page */ )
        remove_post_type_support( 'page', 'editor' );
share|improve this answer
+1 for that working snippet, thanks for sharing it. – amit Jul 9 '12 at 18:09
Works great. Hardcoding the page ID # doesn't, though. Also: how did you determine the string 'page_on_front' for the "Home" page? How do I target other pages by name? – markratledge Jul 9 '12 at 18:20
page_on_front is the ID for the "static front page" under Settings > Reading. You can use other properties of $post to compare to, like post_name (the slug) or post_title (the title). – TheDeadMedic Jul 9 '12 at 18:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.