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 have a custom post type Events.

Under Events, I have a custom meta box which selects the time and data of the event:

$meta_boxes[] = array(
'id'         => 'event_date_option',
'title'      => __('Event date'),
'pages'      => 'events',
'context'    => 'normal',
'priority'   => 'high',
'show_names' => true,
'fields'     => array(
        'name' => __('Event Date'),
        'desc' => __('When will the event happen'),
        'id'   => '_event_date',
        'type' => 'text_date',
        'name' => __('Event Time'),
        'desc' => __('What time will the event start'),
        'id'   => '_event_time',
        'type' => 'text_time',

How can I save the date and time in a different table in my WP database when the admin clicks "Publish" or "Update"?

share|improve this question

As you can read in the WordPress Codex, you have to write your own save function for any meta box anyways. So instead of saving those values with a function like update_post_meta(), you could simply implement your own saving function using another table. But you also have to write a corresponding load function, as the using get_post_meta() function in the meta box render callback will not work for obvious reasons.

share|improve this answer

Your Answer


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.