WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've created a custom post type with one meta box. I've already tried everything, but its still not saving the value. Please help.

 add_action('init', 'create_post_type');

 function create_post_type() {
 register_post_type('jh_dedications',
        array(
                'labels' => array (
                                    'name' => __('Dedications'),
                                    'singular_name' => __('Dedication')
                                    ),
                                    'public' => true,
                                    'has_archive' => true,
                                    'supports' => array('title','editor','thumbnail'),
                                    'show_ui' => true
                                    )
                    );
 }

 add_action ("add_meta_boxes", "add_dedications_jh");

 function add_dedications_jh() {
add_meta_box('jh_datepicker', 'Select Date', 'jh_datepicker', 'jh_dedications', 'side', 'default');
 }

 function jh_datepicker() {
global $post;
$custom = get_post_custom($post->ID);
$dedicationDate = $custom["dedicationDate"][0];

?>
<input type="text" name="dedicationDate" value="<?php echo $dedicationDate; ?>" /> 
<?php 
 }

 add_action('wp_insert_post_data', 'jh_save_dedication');

 function jh_save_dedication() {
global $post;

if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
    return $post->ID;

update_post_meta($post->ID, "dedicationDate", $POST["dedicationDate"]); 
 }
share|improve this question

php superglobal is $_POST, not $POST.

update_post_meta($post->ID, "dedicationDate", $_POST["dedicationDate"]);
share|improve this answer
    
Thank you so much! – MF1 Aug 30 '12 at 17:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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