• Resolved americannoise

    (@americannoise)


    Hi everyone,

    I’d like to manually remove some items from the Add New post page, but I’m not sure where the code is located. Basically, here’s the scenario:

    I will have an open-registration forum. However, I don’t want Contributors to have the option to dis-allow comments–and I don’t want them to be able to select where to send trackbacks. I was to completely remove those options from the page that gets served to them in the backend.

    I understand that taking out the code will remove them for ALL user levels. Any help is appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Each area on the edit post page is added as a “meta box”.

    Look at the several “add_meta_box(blah blah blah)” in /wp-admin/ edit_form_advanced.php

    To remove ‘Discussion’ and ‘Send Trackbacks’ from the edit_form_advanced.php you could use the following in a plugin:

    WP3.0

    <?php
    add_action( 'admin_head', 'fewer_meta_boxes');
    function fewer_meta_boxes() {
    global $post_type;
    remove_meta_box('commentstatusdiv', $post_type, 'normal');
    remove_meta_box('trackbacksdiv', $post_type, 'normal');
    }
    ?>

    WP2.9.x

    <?php
    add_action( 'admin_head', 'fewer_meta_boxes');
    function fewer_meta_boxes() {
    remove_meta_box('commentstatusdiv', 'post_comment_status_meta_box', 'normal');
    remove_meta_box('trackbacksdiv', 'post_trackback_meta_box', 'normal');
    }
    ?>

    Or just remove it for anyone not an admin..

    <?php
    /*
      This code is based on WP 3.0, see code in post above for 2.9 example.
    */
    add_action( 'admin_head-post-new.php', 'fewer_meta_boxes');
    add_action( 'admin_head-post.php', 'fewer_meta_boxes');
    function fewer_meta_boxes() {
    	global $post_type;
    	if( !current_user_can( 'manage_options' ) ) {
    		remove_meta_box('commentstatusdiv', $post_type, 'normal');
    		remove_meta_box('trackbacksdiv', $post_type, 'normal');
    	}
    }
    ?>

    Thread Starter americannoise

    (@americannoise)

    Super, guys. Thanks for the help. I really appreciate it.

    ontargetpro

    (@ontargetpro)

    This is very, very helpful, thanks!

    The only trouble I had is that I had to make the changes to the Thesis custom_function file because I have a multisite setup with each site using its own css and functions files. As soon as I change that file, every time I go to edit a post, it tells me that someone is editing it. Weird.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Manually remove items from “Add New” post page’ is closed to new replies.