tammyhart / Reusable-Custom-WordPress-Meta-Boxes

177 stars 97 forks source link

NONCE index error #4

Closed wesdekoninck closed 11 years ago

wesdekoninck commented 12 years ago

When using this script to create multiple meta boxes, I was throwing errors related to the nonce and it looks like you are not checking to see if the nonce is set in addition to verifying it.

I was able to solve the issue by changing the following in meta_box.php:

Change this:

// verify nonce
if (!wp_verify_nonce($_POST[$page.'_meta_box_nonce'], basename(__FILE__))) 
      return $post_id;

To This:

// if nonce exists, verify nonce
if ( !isset( $_POST[$page.'_meta_box_nonce'] ) || !wp_verify_nonce( $_POST[$page.'_meta_box_nonce'], basename( __FILE__ )))
    return $post_id;
tammyhart commented 11 years ago

this has been fixed. thanks.