admin管理员组文章数量:1430624
I've used wp_send_json() to send the currently posted form data but cannot find a way to send the id attached to it which is incremented automatically from the database,, so that i can update the table data on the page without refreshing...
I've used wp_send_json() to send the currently posted form data but cannot find a way to send the id attached to it which is incremented automatically from the database,, so that i can update the table data on the page without refreshing...
Share Improve this question asked May 15, 2019 at 17:07 Bikash GurungBikash Gurung 213 bronze badges1 Answer
Reset to default 0From an example in the Developer Reference:
To get the id of the inserted object use
$wpdb->insert_id;
global $wpdb; $table = $wpdb->prefix.'you_table_name'; $data = array('column1' => 'data one', 'column2' => 123); $format = array('%s','%d'); $wpdb->insert($table,$data,$format); $my_id = $wpdb->insert_id;
版权声明:本文标题:php - How can i send id of the currently posted form data through json response in custom wordpress plugin? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745490263a2660572.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论