Why do Metabox use Nonces?

WordPress nonces are meant to prevent unauthorized execution of code. In the case of meta boxes, they are protecting you against malicious users potentially adding unauthorized meta-information to your posts and pages by forging POST requests. Why wouldn’t you want to use nonces?

Custom Meta Box Causing Error: “Are you sure you want to do this? Please try again.”

so you need to correct your nonce field add a second pram nonce name, more information on WordPress codex here // wp nonce field wp_nonce_field( $action, $name, $referer, $echo ); // replace yours with below wp_nonce_field( ‘ind_pricing_table_box_nonce’, ‘ind_pricing_nonce’ ); now verify your nonce, more info here wp_verify_nonce( $nonce, $action ); // replace yours with below … Read more

How to add editable/dynamic values to dropdown of a Custom Post Type Meta Box

I made a similar site and created each team as a custom post type. For the meta fields I did: $report_custom_meta_fields = array( array( ‘label’ => ‘Match Date’, ‘desc’ => ‘Choose match date’, ‘id’ => $prefix.’date’, ‘type’ => ‘date’ ), array( ‘label’ => ‘Select Home Team’, ‘desc’ => ‘Select home team from list’, ‘id’ => … Read more

Metabox Not saving data

I optimized your function. <?php function dd_hctb_create() { add_meta_box (‘dd_meta’, ‘Heading Content Text Box’, ‘dd_hctb_cb’, ‘page’, ‘normal’, ‘high’); } // function dd_hctb_create add_action(‘add_meta_boxes’, ‘dd_hctb_create’); function dd_hctb_cb($post) { wp_nonce_field(basename(__FILE__), ‘dd_mbe_content_nonce’); //retrieve the metadata values if they exist $value = get_post_meta($post->ID, ‘dd_mbe_content’, true); ?> <p> Write any content in here that you want to appear above the … Read more

Why does not my metabox save?

I notice a couple of things. First, your callback uses two parameters but you don’t ask for the second parameter when you hook it in. This: add_action( ‘save_post’, ‘kasparibi_left_menu_meta_save’ ); Should be: add_action( ‘save_post’, ‘kasparibi_left_menu_meta_save’ ,1 ,2 ); But, on the other hand, I don’t see where you use that parameter at all. Maybe I … Read more