如果查询正确并返回user_id
然后您可以运行下面的
foreach($user_id_array as $user_id){
echo get_the_author_meta( \'user_email\', $user_id );
echo "<br>";//to print in new line for each user mail
}
您可以在页面模板或任何模板挂钩中使用上述内容。例如,您可以在
wp_head
,
wp_footer
等
让我们在一张空白的纸上做这件事。让我们假设page_id
是8
然后,下面的过滤器将执行此操作
function print_selected_umail($content){
//check if we are in required page(8), so that we can add the selected user mail
if(is_page(8)){
//queried result
foreach($user_id_array as $user_id){
$content .= get_the_author_meta( \'user_email\', $user_id );
$content .= "<br>";//to print in new line for each user mail
}
}
return $content;
}
add_filter(\'the_content\',\'print_selected_umail\');