我已经获得了用户注册,可以使用user\\u register挂钩自动创建一篇帖子,但是标题显示为(没有标题),有人能帮我解决我这里的错误吗?
add_action(\'user_register\',\'create_new_user_post\');
$userinfo = get_userdata($user_id);
$disname = $userinfo->display_name;
function create_new_user_post($user_id){
if (!$user_id>0)return;
// Create post object
$my_bio_post = array(
// \'post_type\' => \'ggs_user_post_type\',
\'post_title\' => $disname,
\'post_content\' => \'Put cool content here!\',
\'post_status\' => \'publish\',
\'post_author\' => $user_id
);
// Insert the post into the database
$bio = wp_insert_post( $my_bio_post );
//and if you want to store the post ids in
//the user meta then simply use update_user_meta
update_user_meta($user_id,\'_bio_post\',$bio);
}