• I am looking for a way to define which screen options should be selected (and therefore displayed) by default for every user.

    I have a site with a several contributors, not all of them are very computer savvy. When they add or edit a page, some of the content / option boxes were not showing (like slug, author, etc) but were for other people.

    I am not looking at disabling all the screen options (i already have adminimize installed) – just defining what screen options are defined by default.

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Tim Nash

    (@tnash)

    Spam hunter

    There might be a plugin that does this for you, but otherwise you can do this in code, and create your own plugin or add it to your theme functions.php (not recommended) for example of how to do it in code.

    http://wordpress.stackexchange.com/questions/15376/how-to-set-default-screen-options

    Thread Starter ts_hamlet

    (@ts_hamlet)

    Hi, thanks for the reply. I have copied this code into my child-themes functions.php:

    add_action('admin_init', 'set_user_metaboxes');
    function set_user_metaboxes($user_id=NULL) {
    
        // These are the metakeys we will need to update
        $meta_key['order'] = 'meta-box-order_post';
        $meta_key['hidden'] = 'metaboxhidden_post';
    
        // So this can be used without hooking into user_register
        if ( ! $user_id)
            $user_id = get_current_user_id(); 
    
        // Set the default order if it has not been set yet
        if ( ! get_user_meta( $user_id, $meta_key['order'], true) ) {
            $meta_value = array(
                'side' => 'submitdiv,formatdiv,categorydiv,postimagediv',
                'normal' => 'postexcerpt,tagsdiv-post_tag,postcustom,commentstatusdiv,commentsdiv,trackbacksdiv,slugdiv,authordiv,revisionsdiv',
                'advanced' => '',
            );
            update_user_meta( $user_id, $meta_key['order'], $meta_value );
        }
    
        // Set the default hiddens if it has not been set yet
        if ( ! get_user_meta( $user_id, $meta_key['hidden'], true) ) {
            $meta_value = array('postcustom','trackbacksdiv','commentstatusdiv','commentsdiv','slugdiv','authordiv','revisionsdiv');
            update_user_meta( $user_id, $meta_key['hidden'], $meta_value );
        }
    }

    But it seems to make no difference?

    Thread Starter ts_hamlet

    (@ts_hamlet)

    To be clear – i am not looking at hiding boxes, simply making sure that certain ones are checked (ticked) by default.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add/edit Page – Default screen options’ is closed to new replies.