I recently switched themes and copied over my metaboxes from the old functions.php into the new one. They show up but when I click publish/edit they dont save
add_action( 'add_meta_boxes', 'cd_meta_box_add' );
function cd_meta_box_add() {
add_meta_box( 'my-meta-box-id', 'Video', 'omc_video_encode', 'post', 'normal', 'high' );
add_meta_box( 'my-meta-box-id-a', 'Audio', 'omc_audio_encode', 'post', 'normal', 'high' );
add_meta_box( 'my-meta-box-id-d', 'Download', 'download_link', 'post', 'normal', 'high' );
}
function omc_video_encode() {
?>
<label for="omc_video_encode">Iframe here.</label>
<input style="width: 500px;" type="text" name="omc_video_encode" id="omc_video_encode" />
<?php
}
function omc_audio_encode() {
?>
<label for="omc_audio_encode">Jwplayer here.</label>
<input style="width: 500px;" type="text" name="omc_audio_encode" id="omc_audio_encode" />
<?php
}
function download_link() {
?>
<label for="download_link">Link here.</label>
<input style="width: 500px;" type="text" name="download_link" id="download_link" />
<?php
}
add_action( 'save_post', 'cd_meta_box_save' );
function cd_meta_box_save( $post_id ) {
// Bail if we're doing an auto save
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
// if our nonce isn't there, or we can't verify it, bail
if ( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) )
return;
// if our current user can't edit this post, bail
if ( !current_user_can( 'edit_post' ) )
return;
}