function wpdocs_register_meta_boxes() { add_meta_box( 'meta-box-id', __( 'Backend Name', 'textdomain' ), 'wpdocs_my_display_callback', 'post_type' ); } add_action( 'add_meta_boxes', 'wpdocs_register_meta_boxes' ); function wpdocs_my_display_callback( $post ) { // INPUT FIELDS GO HERE ?> <label>Year: <input type="text" name="inputName" value="<?php echo get_post_meta(get_the_ID(), 'meta_key')[0]; ?>" /></label> <?php } /** * Save meta box content. * * @param int $post_id Post ID */ function wpdocs_save_meta_box( $post_id ) { // LOGIC GOES HERE if( isset( $_POST['year'] ) ){ update_post_meta( $post_id, 'meta_key', wp_kses( $_POST['inputName'], $allowed ) ); } } add_action( 'save_post', 'wpdocs_save_meta_box' );
Author: Wojciech Borowicz
I hope this post will help you to do what you need.
In case you want some assistance click here to get in touch