I’m growing customized theme from scratch and creates a customized submit kind and getting this warning whereas enhancing customized submit kind. I additionally design customized Meta field with two enter fields and utilizing nonce in it. Any assist eradicating these warning?
Right here is code of customized metabox in features.php
//Customized Metabox
perform register_book_meta_box(){
add_meta_box('book_meta_box_id', 'E-book Element','design_book_meta_box','books','superior','excessive');
}
add_action('add_meta_boxes','register_book_meta_box');
perform design_book_meta_box($submit){
wp_nonce_field(basename(__FILE__),'book_cpt_nonce')
?>
<div>
<label for="book-author">Creator Identify </label>
<enter kind="text" identify="book-author" placeholder="Author Name" worth="<?php echo get_post_meta( $post->ID, 'book-author-key', true );?>">
</div>
<div>
<label for="year">Revealed 12 months</label>
<enter kind="number" id="year" identify="year" min="1455" max="2020" worth="<?php echo get_post_meta( $post->ID, 'book-year-key', true );?>">
<span id="errorMsg" type="display:none;">Revealed 12 months Have to be vary from 1455 - 2020</span>
</div>
<?php
}
perform save_book_meta_data($post_id)
{
if(!isset($_POST['book_cpt_nonce']) || !wp_verify_nonce($_POST['book_cpt_nonce'],basename(__FILE__))){
return $post_id;
}
if (array_key_exists('book-author', $_POST)) {
update_post_meta( $post_id,'book-author-key', $_POST['book-author']
);
}
if (array_key_exists('yr', $_POST)) {
update_post_meta( $post_id,'book-year-key', $_POST['year']
);
}
}
add_action('save_post', 'save_book_meta_data');