wxr_authors_list

Output list of authors with posts.

Description

wxr_authors_list(); 

Usage

  1. if ( !function_exists( 'wxr_authors_list' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'advanced-custom-fields/core/actions/export.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wxr_authors_list(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/core/actions/export.php  
  1. function wxr_authors_list() { 
  2. global $wpdb; 
  3.  
  4. $authors = array(); 
  5. $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts" ); 
  6. foreach ( (array) $results as $result ) 
  7. $authors[] = get_userdata( $result->post_author ); 
  8.  
  9. $authors = array_filter( $authors ); 
  10.  
  11. foreach( $authors as $author ) { 
  12. echo "\t<wp:author>"; 
  13. echo '<wp:author_id>' . $author->ID . '</wp:author_id>'; 
  14. echo '<wp:author_login>' . $author->user_login . '</wp:author_login>'; 
  15. echo '<wp:author_email>' . $author->user_email . '</wp:author_email>'; 
  16. echo '<wp:author_display_name>' . wxr_cdata( $author->display_name ) . '</wp:author_display_name>'; 
  17. echo '<wp:author_first_name>' . wxr_cdata( $author->user_firstname ) . '</wp:author_first_name>'; 
  18. echo '<wp:author_last_name>' . wxr_cdata( $author->user_lastname ) . '</wp:author_last_name>'; 
  19. echo "</wp:author>\n";