When you are in the dashboard, the options checked and unchecked in the "Screen Options" pane seem to me to be completely random and arbitrary and cause lots of confusion when something doesn't show up that you need that "should" be there but isn't. Is there some way to influence which of these options are checked, and make that stick for all users?


3 Answers 3


1) Copy this codes and paste it in your editor and save it as enable_custom_field.php. Then, create a folder named "Enable Custom Field By Default" and put that PHP file in this folder. Like this, your created with your own plugin. Just put this folder in your plugin folder and activate it in your admin page.

Plugin Name: Enable Custom Fields per Default
Version:     1.0
Required:    3.1
Author:      Thomas Scholz
Author URI:  http://toscho.de
License:     GPL
! defined( 'ABSPATH' ) and exit;
add_filter( 'default_hidden_meta_boxes', 'enable_custom_fields_per_default', 20, 1 );

 * Removes custom fields from the default hidden elements.
 * The original ( wp-admin/includes/template.php#get_hidden_meta_boxes() ):
 * array(
 *      'slugdiv',
 *      'trackbacksdiv',
 *      'postcustom',      <-- we need this
 *      'postexcerpt',
 *      'commentstatusdiv',
 *      'commentsdiv',
 *      'authordiv',
 *      'revisionsdiv'
 * )
 * It has no effect if the user has decided to hide the box.
 * This option is saved in "metaboxhidden_{$screen->id}"
 * @param  array $hidden
 * @return array $hidden
function enable_custom_fields_per_default( $hidden )
    foreach ( $hidden as $i => $metabox )
        if ( 'postcustom' == $metabox )
            unset ( $hidden[$i] );
    return $hidden;

2) I have tried this one by creating new user in my admin page and logged in with that user. Custom fields are there in my page's edit section. It worked like a charm.

  • This code from another answer would not make the options stick. Why didn’t you just link to that answer?
    – fuxia
    Commented Dec 21, 2012 at 9:54
  • Actually i thought to link only.But, then i thought somebody will be unaware of using this code in their own plugin.So, to be clear, i did like that. Commented Dec 21, 2012 at 10:53

Possibly already answered here : How to set default screen options?

  • Thanks, I'll look at that. At first glance I'm not really following what that answer is saying, but hopefully it will answer my question. I'll update once I find out...
    – cmcculloh
    Commented Jun 28, 2011 at 17:41

mike23's link gives the hint to the following function:

// add_action('user_register', 'wpse20505_set_user_metaboxes');
add_action('admin_init', 'wpse20505_set_user_metaboxes');
function wpse20505_set_user_metaboxes($user_id=NULL) {
    $meta_key['hidden'] = 'metaboxhidden_dashboard';
    $meta_value = array(
    $blogusers = get_users('blog_id=1');
    foreach ($blogusers as $user) {
        // this conditional will check if the user already set his preferences and may be removed if wanted
        if ( ! get_user_meta( $user->ID, $meta_key['hidden'], true) ) {
            update_user_meta( $user->ID, $meta_key['hidden'], $meta_value );

The admin_init need to be run only once, and then user_register may be enabled to configure the dashboard for new users.

The meta_value array contains all the widgets and may be customized to your needs.

Your Answer

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

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