wp_credits

Retrieve the contributor credits.

Description

(array|false) wp_credits(); 

Returns (array|false)

A list of all of the contributors, or false on error.


Usage

  1. if ( !function_exists( 'wp_credits' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/credits.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_credits(); 
  7.  

Defined (1)

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

/wp-admin/includes/credits.php  
  1. function wp_credits() { 
  2. $wp_version = get_bloginfo( 'version' ); 
  3. $locale = get_user_locale(); 
  4.  
  5. $results = get_site_transient( 'wordpress_credits_' . $locale ); 
  6.  
  7. if ( ! is_array( $results ) 
  8. || false !== strpos( $wp_version, '-' ) 
  9. || ( isset( $results['data']['version'] ) && strpos( $wp_version, $results['data']['version'] ) !== 0 ) 
  10. ) { 
  11. $response = wp_remote_get( "http://api.wordpress.org/core/credits/1.1/?version={$wp_version}&locale={$locale}" ); 
  12.  
  13. if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) 
  14. return false; 
  15.  
  16. $results = json_decode( wp_remote_retrieve_body( $response ), true ); 
  17.  
  18. if ( ! is_array( $results ) ) 
  19. return false; 
  20.  
  21. set_site_transient( 'wordpress_credits_' . $locale, $results, DAY_IN_SECONDS ); 
  22.  
  23. return $results;