Hallo,
ich habe mir zu meinem Custom Post Type eine Metabox hinzugefügt. Die Daten werden auch gespeichert (in DB kontrolliert), wenn ich jedoch die Daten beim Bearbeiten wieder in die Textarea laden will, klappt das noch nicht.
Wer kann mir helfen?
PHP
// Content for the custom meta box
function jdev_custom_meta_box_content( $post ) {
echo '<textarea name="jdev-custom-meta-box" cols="50" rows="7" style="width:99%">'.get_post_meta($post->ID, '_jdev-custom-meta', true).'</textarea>';
}
// Save your meta box content
add_action( 'save_post', 'jdev_save_custom_meta_box' );
// save newsletter content
function jdev_save_custom_meta_box(){
global $post;
// Get our form field
if( $_POST ) :
$jdev_custom_meta = esc_attr( $_POST['jdev-custom-meta-box'] );
// Update post meta
update_post_meta($post->ID, '_jdev_custom_meta', $jdev_custom_meta);
endif;
}
Alles anzeigen