Forums

disable post/page field through plugin or theme? (2 posts)

  1. MACscr
    Member
    Posted 2 years ago #

    I am trying to figure out if there is a way to disable a particular part of the post/page editor. Lets say i want to hide or just disable (aka, no edit) the Discussion field or maybe the Excerpt field, etc. Any ideas how i might do this? I want to do itthrough code, obviously i know i can just minimize those fields, but i am looking for more control than that.

  2. add_action( 'do_meta_boxes', 'macscr_remove_meta_boxes' );
    
    function macscr_remove_meta_boxes( $post_type ) {
    	if ( 'post' == $post_type )
    		remove_meta_box( 'commentstatusdiv', $post_type, 'normal' );
    
    	if ( 'page' == $post_type )
    		remove_meta_box( 'postexcerpt', $post_type, 'normal' );
    }

    It's basically the reverse of add_meta_box().

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.