admin管理员组

文章数量:1336110

Will someone help me in this.

add_action( 'save_post', 'product_price_box_save' );
function product_price_box_save( $post_id ) {

    if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 
    return;

    global $wpdb;

    if ( wp_verify_nonce( $_POST['store_details_box_content_nonce'], 'store_details_box_content' ) ) {

        if (is_int($_POST['store_pincode'])) {
            # code...
            $store_pincode = htmlentities(trim($_POST['store_pincode']));
        }
        $wpdb->insert('cs_shop_details', array(
            'post_id' => $post_id,
            'shop_pincode' => $store_pincode,
        ), array("%d", "%d"));
        $wpdb->show_errors();
  }

}

Does anyone have idea why the data isn't entered to database even the code looks good. Am I missing something or doing it wrong. What I want to achieve is that when user publishes or updates the post the data should be saved to custom made database table. Thanks.

本文标签: pluginswpdbgtinsert not working inside savepost tag