3

This is probably a stupid question, but I am setting up a finnish Wordpress installation. The "custom fields" section in the "write post" section is gone; I gather it is hidden by default.

That is a great step, but my finnish is a bit rusty, it's my first WP install, and I can't for the life of me find the switch to turn it on.

Where do I do this?

Edit: Martin shows a way to do this on a per-post basis, thanks for that. In my case, it would be useful to always show custom fields, so extra brownie points for anybody who can give me a hint on how to do that. I can't find any documentation on this.

1
  • p.s. there is no such thing as "WP3". There is WP 3.0, and WP 3.1, but "WP3" is a non-entity. Commented May 1, 2011 at 12:58

2 Answers 2

2

Per default some meta boxes are hidden. These boxes are stored in an array which you can find in wp-admin/includes/template.php#get_hidden_meta_boxes(). There is a filter, and therefore a chance for a plugin:

<?php # -*- coding: utf-8 -*-
/*
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;
}

As you can see, it is quite simple to enable more fields.

1
  • Sweet, thanks a lot! This makes the change completely globally.
    – Pekka
    Commented May 3, 2011 at 13:59
6

Go to edit/create a page or post in wp-admin at the top is a "Screen Options" panel link, here you can enable custom fields for that particular page or post.

Screen Options tab (closed)
Screen Options tab (opened)

The number of metaboxes displayed by default was reduced in 3.1. If you want to change the default for all users you can hook into the default_hidden_meta_boxes filter.

2
  • Got it. Thanks! I'll leave this question open in case somebody comes up with a permanent option to show this field, which I would prefer. But this helps me for the moment.
    – Pekka
    Commented May 1, 2011 at 9:43
  • 3
    This isn't a per post setting. Once you've changed your screen options, you'll see custom fields on your post edit screen for all posts.
    – anu
    Commented May 1, 2011 at 9:46

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.