Php 如果选择了当前文章的类别,如何在wordpress的“我的表格”中插入数据?
我需要检查当前帖子是否属于某个类别,如果选择了某个术语,则在表(已创建)中插入一些数据 在人类可读的格式中,我希望做如下操作: 如果选择了教育类别,请在表请求中插入“数据” 我尝试过这个代码,但我的表中没有注册任何内容Php 如果选择了当前文章的类别,如何在wordpress的“我的表格”中插入数据?,php,mysql,wordpress,Php,Mysql,Wordpress,我需要检查当前帖子是否属于某个类别,如果选择了某个术语,则在表(已创建)中插入一些数据 在人类可读的格式中,我希望做如下操作: 如果选择了教育类别,请在表请求中插入“数据” 我尝试过这个代码,但我的表中没有注册任何内容 global $wpdb, $current_user; get_currentuserinfo(); $uid = $current_user->ID; $pid = $_GET['auction_id']
global $wpdb, $current_user;
get_currentuserinfo();
$uid = $current_user->ID;
$pid = $_GET['auction_id'];
$tm = current_time('timestamp',0);
$auction_cat = wp_get_object_terms($pid, 'auction_cat');
$cate = array($auction_cat[0]->term_id);
// check if the category of auction is University_Id = 4
if (in_array(4, $cate))
{
$wpdb->query("insert into ".$wpdb->prefix."auction_requests (pid, uid, datemade) values('$pid','$uid',$tm')");
}
任何帮助都将不胜感激!提前谢谢