I've got a custom meta box for a custom post type which will be the only metabox I plan to show in the main column (except the native title box). I want to move the native Expert box/field inside my Custom Meta Box.

I'm able to create a field called Excerpt in my Meta Box, however I only know how to save this to the Custom Fields, not the original location that the native Except saves to.


Just name the field 'excerpt'.


<textarea name="excerpt" id="excerpt"><?php echo esc_html( '$post->post_excerpt' ); ?></textarea> <!-- if it is a textarea field -->


<input name="excerpt" id="excerpt" value="<?php echo esc_attr( '$post->post_excerpt' ); ?>" /> <!-- if it is a text field -->
  • Where can I find the documentation to do this with other metaboxes? I guess I really only need to know the IDs of the other wordpress native metaboxes. – matt Dec 6 '10 at 17:21
  • Nevermind, that was a silly question. I just looked at the code in firebug and it was right there. – matt Dec 6 '10 at 17:25

This would be a function to update the post_excerpt with a field with the name 'my_custom_field'.

function my_custom_save_function($post_id){
    update_post(array('ID' => $post_id, 'post_excerpt' => $_POST['my_custom_field']));
add_action('save_post', 'my_custom_save_function');
  • I figured it would be done with a hook but I'm wondering why you prefer this approach to the one sorich suggested? His seems a little lighter. – matt Dec 6 '10 at 16:11
  • I prefer this way as it seens to me a much cleaner to me and its easier to extend. Normally you gonna add much more fields then just one and then you have to use this hook anyway. – Horttcore Dec 7 '10 at 8: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.