0

I am using the following code to add excerpts to certain post types within Wordpress and for some rather odd reason, the excerpt fields only appear for the default administrator account, i.e. admin

function connect_addexcerpt() {
    add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'page', 'normal', 'core');
    add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'clinic_location', 'normal', 'core');
    add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'clinic_group', 'normal', 'core');
    add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'career', 'normal', 'core');
}
add_action( 'admin_menu', 'connect_addexcerpt' );


When creating a new user, the field is simply hidden?

Edit: Sorry what I meant to say, was when logging in with a new account, the field is hidden.

Does anyone have any idea's what could be causing this?

2
  • I assume you are using Custom Post Types? If so, are you using the supports option and including excerpt when you register the post types?
    – David Gard
    Jan 23 '14 at 14:30
  • Sorry for the delay, been uber busy. I've tried both setting it via the supports and using my method above. They appear fine for the default admin user, but for some reason not for other users (who are also administrators.)
    – Gavin
    Jan 29 '14 at 11:04
1

To correctly show the Excerpt meta box for Custom Post types you should use the supports property register_post_type. Supported values are as follows, and I suggest referring to the register_post_type Function Reference for more details -

  • 'title'
  • 'editor' (content)
  • 'author'
  • 'thumbnail' (featured image, current theme must also support post-thumbnails)
  • 'excerpt'
  • 'trackbacks'
  • 'custom-fields'
  • 'comments' (also will see comment count balloon on edit screen)
  • 'revisions' (will store revisions)
  • 'page-attributes' (menu order, hierarchical must be true to show Parent option)
  • 'post-formats' add post formats, see Post Formats

The purpose of add_meta_box is primarily to "allow plugin developers to add meta boxes to the administrative interface". So really you should only use it to add your own custom meta boxes, and there is no need to use it to add built in meta boxes.

As a side note, the docs for add_meta_box also note the following -

This function should be called from the 'add_meta_boxes' action.

Update

Also, please check that the other users have selected to show the Excerpt box, as I believe it is hidden by default. To do this click Screen Options and then ensure that Excerpt is ticked.

enter image description here

2
  • Hi there, sorry about the delay. - The register_post_type method is also being called with excerpt added to the list of supported fields. Not sure what's going on :(#
    – Gavin
    Jan 29 '14 at 11:05
  • Could it be as simple as the user needing to choose to show the excerpt? They can click Screen Option at the top of the page and tick/untick what they wish to show/hide.
    – David Gard
    Jan 29 '14 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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