我正在使用publish\\u post操作在用户的帖子发布后对其运行一些检查:
$author_ID = ????
add_action(\'publish_post\', \'rhb_check_current_user\', 10, $author_ID);
如何获取原始作者的ID?我正在使用publish\\u post操作在用户的帖子发布后对其运行一些检查:
$author_ID = ????
add_action(\'publish_post\', \'rhb_check_current_user\', 10, $author_ID);
如何获取原始作者的ID?使用
add_action(\'publish_post\', \'rhb_check_current_user\');
function rhb_check_current_user(){
global $post;
$author_id = $post->post_author;
...
...
}
我想get_currentuserinfo() 就是你要找的。
我有一个查询用户和usermeta的自定义插件,但我现在需要从结果中筛选管理员。我的sql查询的一个非常简化的版本是:SELECT * FROM usermeta LEFT JOIN users ON users.ID = user_id WHERE meta_key = \'last_name\' AND user_role != \'admin\' ORDER BY meta_value ASC LIMIT 0, 25 user_role 不是字段,我看