好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

获取 WordPress 所有用户的电子邮件 - WordPress

获取 WordPress 所有用户的电子邮件

下面的代码可以帮你快速地将所有注册用户的电子邮件以列表的形式展示出来,代码如下:

<?php   $args  =  array ( 'orderby'  =>  'display_name' );  $wp_user_query  =  new  WP_User_Query( $args );  $authors  =  $wp_user_query ->get_results();  if  (!emptyempty( $authors )) {        echo   '<ul>' ;        foreach  ( $authors   as   $author ) {             $author_info  = get_userdata( $author ->ID);             echo   '<li>'  .  $author_info ->user_email .  '</li>' ;       }        echo   '</ul>' ;  }  else  {        echo   'No results' ;  } ?> 

可以将代码根据需要放在主题适当的位置上.

查看更多关于获取 WordPress 所有用户的电子邮件 - WordPress的详细内容...

  阅读:63次