Undefined index: _noncename !wp_verify_nonce with meta box
-
Please help. The following two errors are generated while using my plugin with debug=true.
Notice: Undefined index: name in /Applications/XAMPP/xamppfiles/htdocs/wordpress2/wp-content/plugins/Employee/EmployeePostType.php on line 155Notice: Undefined index: _noncename in /Applications/XAMPP/xamppfiles/htdocs/wordpress2/wp-content/plugins/Employee/EmployeePostType.php on line 155
/***************MY CODE ************************\
function save_postdata( $post_id ) { global $post, $new_meta_boxes; foreach($new_meta_boxes as $meta_box) { // Verify if ( !wp_verify_nonce( $_POST[$new_meta_box['name'].'_noncename'], plugin_basename(__FILE__) )){ return $post_id; } if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can( 'edit_page', $post_id )) return $post_id; } else { if ( !current_user_can( 'edit_post', $post_id )) return $post_id; } $data = $_POST[$meta_box['name']]; if(get_post_meta($post_id, $meta_box['name']) == "") add_post_meta($post_id, $meta_box['name'], $data, true); elseif($data != get_post_meta($post_id, $meta_box['name'], true)) update_post_meta($post_id, $meta_box['name'], $data); elseif($data == "") delete_post_meta($post_id, $meta_box['name'], get_post_meta($post_id, $meta_box['name'], true)); } } add_action('admin_menu', 'create_meta_box'); add_action('save_post', 'save_postdata');
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Undefined index: _noncename !wp_verify_nonce with meta box’ is closed to new replies.