1

A few months ago I asked a similar question: Is it possible to remove the main rich Text box editor? and got the following answer:

function remove_pages_editor(){
    remove_post_type_support( 'page', 'editor' );
}   
add_action( 'init', 'remove_pages_editor' );

This code removes the editor from all pages. Can I remove if from specific pages (by post-ID) somehow? Thanks!

1 Answer 1

3

There is an add_meta_boxes function that fires that you can hook into - it fires whenever the edit post page is rendered.

At that point, you can get the ID of the post being edited using get_the_ID(). You can then compare it to the ID for which you want to remove the post editor:

function remove_pages_editor(){
    if(get_the_ID() == 23) {
        remove_post_type_support( 'post', 'editor' );
    } // end if
} // end remove_pages_editor
add_action( 'add_meta_boxes', 'remove_pages_editor' );
1
  • Thanks Tom! I cannot test it quite yet - since 1&1 just broke my site (...unfortunate to inform you that you are one of the affected customers that is why your website is showing "forbidden" and cannot see any of the dirctories from the root...) I'll assume it works and give ya the check. Feb 24, 2012 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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