wp_credits() WordPress Function

The wp_credits() function displays information about the contributors to the current WordPress installation. This information includes the WordPress version, the location of the WordPress codebase, and the names of the core developers.

wp_credits( string $version = '', string $locale = '' ) #

Retrieve the contributor credits.


Parameters

$version

(string)(Optional)WordPress version. Defaults to the current version.

Default value: ''

$locale

(string)(Optional)WordPress locale. Defaults to the current user's locale.

Default value: ''


Top ↑

Return

(array|false) A list of all of the contributors, or false on error.


Top ↑

Source

File: wp-admin/includes/credits.php

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function wp_credits( $version = '', $locale = '' ) {
    if ( ! $version ) {
        // Include an unmodified $wp_version.
        require ABSPATH . WPINC . '/version.php';
 
        $version = $wp_version;
    }
 
    if ( ! $locale ) {
        $locale = get_user_locale();
    }
 
    $results = get_site_transient( 'wordpress_credits_' . $locale );
 
    if ( ! is_array( $results )
        || false !== strpos( $version, '-' )
        || ( isset( $results['data']['version'] ) && strpos( $version, $results['data']['version'] ) !== 0 )
    ) {
        $url     = "http://api.wordpress.org/core/credits/1.1/?version={$version}&locale={$locale}";
        $options = array( 'user-agent' => 'WordPress/' . $version . '; ' . home_url( '/' ) );
 
        if ( wp_http_supports( array( 'ssl' ) ) ) {
            $url = set_url_scheme( $url, 'https' );
        }
 
        $response = wp_remote_get( $url, $options );
 
        if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
            return false;
        }
 
        $results = json_decode( wp_remote_retrieve_body( $response ), true );
 
        if ( ! is_array( $results ) ) {
            return false;
        }
 
        set_site_transient( 'wordpress_credits_' . $locale, $results, DAY_IN_SECONDS );
    }
 
    return $results;
}


Top ↑

Changelog

Changelog
VersionDescription
5.6.0Added the $version and $locale parameters.
3.2.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.