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
版权声明:本文标题:plugins - $wpdb->insert not working inside save_post tag 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742403462a2468345.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论