wp_credits

The timeline below displays how wordpress function wp_credits has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * WordPress Credits Administration API.
 *
 * @package WordPress
 * @subpackage Administration
 * @since 4.4.0
 */
/**
 * Retrieves the contributor credits.
 *
 * @since 3.2.0
 * @since 5.6.0 Added the `$version` and `$locale` parameters.
 *
 * @param string $version WordPress version. Defaults to the current version.
 * @param string $locale  WordPress locale. Defaults to the current user's locale.
 * @return array|false A list of all of the contributors, or false on error.
 */
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) || str_contains($version, '-') || isset($results['data']['version']) && !str_starts_with($version, $results['data']['version'])) {
        $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;
}

WordPress Version: 5.8

/**
 * WordPress Credits Administration API.
 *
 * @package WordPress
 * @subpackage Administration
 * @since 4.4.0
 */
/**
 * Retrieve the contributor credits.
 *
 * @since 3.2.0
 * @since 5.6.0 Added the `$version` and `$locale` parameters.
 *
 * @param string $version WordPress version. Defaults to the current version.
 * @param string $locale  WordPress locale. Defaults to the current user's locale.
 * @return array|false A list of all of the contributors, or false on error.
 */
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;
}

WordPress Version: 5.6

/**
 * WordPress Credits Administration API.
 *
 * @package WordPress
 * @subpackage Administration
 * @since 4.4.0
 */
/**
 * Retrieve the contributor credits.
 *
 * @since 3.2.0
 * @since 5.6.0 Added the `$version` and `$locale` parameters.
 *
 * @param string $version WordPress version. Defaults to the current version.
 * @param string $locale  WordPress locale. Defaults to the current user's locale.
 * @return array|false A list of all of the contributors, or false on error.
 */
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;
}

WordPress Version: 5.4

/**
 * WordPress Credits Administration API.
 *
 * @package WordPress
 * @subpackage Administration
 * @since 4.4.0
 */
/**
 * Retrieve the contributor credits.
 *
 * @since 3.2.0
 *
 * @return array|false A list of all of the contributors, or false on error.
 */
function wp_credits()
{
    // Include an unmodified $wp_version.
    require ABSPATH . WPINC . '/version.php';
    $locale = get_user_locale();
    $results = get_site_transient('wordpress_credits_' . $locale);
    if (!is_array($results) || false !== strpos($wp_version, '-') || isset($results['data']['version']) && strpos($wp_version, $results['data']['version']) !== 0) {
        $url = "http://api.wordpress.org/core/credits/1.1/?version={$wp_version}&locale={$locale}";
        $options = array('user-agent' => 'WordPress/' . $wp_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;
}

WordPress Version: 4.9

/**
 * WordPress Credits Administration API.
 *
 * @package WordPress
 * @subpackage Administration
 * @since 4.4.0
 */
/**
 * Retrieve the contributor credits.
 *
 * @since 3.2.0
 *
 * @return array|false A list of all of the contributors, or false on error.
 */
function wp_credits()
{
    // include an unmodified $wp_version
    include ABSPATH . WPINC . '/version.php';
    $locale = get_user_locale();
    $results = get_site_transient('wordpress_credits_' . $locale);
    if (!is_array($results) || false !== strpos($wp_version, '-') || isset($results['data']['version']) && strpos($wp_version, $results['data']['version']) !== 0) {
        $url = "http://api.wordpress.org/core/credits/1.1/?version={$wp_version}&locale={$locale}";
        $options = array('user-agent' => 'WordPress/' . $wp_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;
}

WordPress Version: 4.7

/**
 * WordPress Credits Administration API.
 *
 * @package WordPress
 * @subpackage Administration
 * @since 4.4.0
 */
/**
 * Retrieve the contributor credits.
 *
 * @since 3.2.0
 *
 * @return array|false A list of all of the contributors, or false on error.
 */
function wp_credits()
{
    $wp_version = get_bloginfo('version');
    $locale = get_user_locale();
    $results = get_site_transient('wordpress_credits_' . $locale);
    if (!is_array($results) || false !== strpos($wp_version, '-') || isset($results['data']['version']) && strpos($wp_version, $results['data']['version']) !== 0) {
        $response = wp_remote_get("http://api.wordpress.org/core/credits/1.1/?version={$wp_version}&locale={$locale}");
        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;
}

WordPress Version: 4.5

/**
 * WordPress Credits Administration API.
 *
 * @package WordPress
 * @subpackage Administration
 * @since 4.4.0
 */
/**
 * Retrieve the contributor credits.
 *
 * @global string $wp_version The current WordPress version.
 *
 * @since 3.2.0
 *
 * @return array|false A list of all of the contributors, or false on error.
 */
function wp_credits()
{
    global $wp_version;
    $locale = get_locale();
    $results = get_site_transient('wordpress_credits_' . $locale);
    if (!is_array($results) || false !== strpos($wp_version, '-') || isset($results['data']['version']) && strpos($wp_version, $results['data']['version']) !== 0) {
        $response = wp_remote_get("http://api.wordpress.org/core/credits/1.1/?version={$wp_version}&locale={$locale}");
        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;
}

WordPress Version: 4.4

/**
 * WordPress Credits Administration API.
 *
 * @package WordPress
 * @subpackage Administration
 * @since 4.4.0
 */
/**
 * Retrieve the contributor credits.
 *
 * @global string $wp_version The current WordPress version.
 *
 * @since 3.2.0
 *
 * @return array|false A list of all of the contributors, or false on error.
*/
function wp_credits()
{
    global $wp_version;
    $locale = get_locale();
    $results = get_site_transient('wordpress_credits_' . $locale);
    if (!is_array($results) || false !== strpos($wp_version, '-') || isset($results['data']['version']) && strpos($wp_version, $results['data']['version']) !== 0) {
        $response = wp_remote_get("http://api.wordpress.org/core/credits/1.1/?version={$wp_version}&locale={$locale}");
        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;
}

WordPress Version: 4.3

/**
 * Retrieve the contributor credits.
 *
 * @global string $wp_version The current WordPress version.
 *
 * @since 3.2.0
 *
 * @return array|false A list of all of the contributors, or false on error.
*/
function wp_credits()
{
    global $wp_version;
    $locale = get_locale();
    $results = get_site_transient('wordpress_credits_' . $locale);
    if (!is_array($results) || false !== strpos($wp_version, '-') || isset($results['data']['version']) && strpos($wp_version, $results['data']['version']) !== 0) {
        $response = wp_remote_get("http://api.wordpress.org/core/credits/1.1/?version={$wp_version}&locale={$locale}");
        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;
}

WordPress Version: 3.9

/**
 * Retrieve the contributor credits.
 *
 * @global string $wp_version The current WordPress version.
 *
 * @since 3.2.0
 *
 * @return array|bool A list of all of the contributors, or false on error.
*/
function wp_credits()
{
    global $wp_version;
    $locale = get_locale();
    $results = get_site_transient('wordpress_credits_' . $locale);
    if (!is_array($results) || false !== strpos($wp_version, '-') || isset($results['data']['version']) && strpos($wp_version, $results['data']['version']) !== 0) {
        $response = wp_remote_get("http://api.wordpress.org/core/credits/1.1/?version={$wp_version}&locale={$locale}");
        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;
}

WordPress Version: 3.8

/**
 * Retrieve the contributor credits.
 *
 * @global string $wp_version The current WordPress version.
 *
 * @since 3.2.0
 *
 * @return array|bool A list of all of the contributors, or false on error.
*/
function wp_credits()
{
    global $wp_version;
    $locale = get_locale();
    $results = get_site_transient('wordpress_credits_' . $locale);
    if (!is_array($results) || isset($results['data']['version']) && strpos($wp_version, $results['data']['version']) !== 0) {
        $response = wp_remote_get("http://api.wordpress.org/core/credits/1.1/?version={$wp_version}&locale={$locale}");
        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;
}

WordPress Version: 3.7

/**
 * Retrieve the contributor credits.
 *
 * @global string $wp_version The current WordPress version.
 *
 * @since 3.2.0
 *
 * @return array A list of all of the contributors.
*/
function wp_credits()
{
    global $wp_version;
    $locale = get_locale();
    $results = get_site_transient('wordpress_credits_' . $locale);
    if (!is_array($results) || isset($results['data']['version']) && strpos($wp_version, $results['data']['version']) !== 0) {
        $response = wp_remote_get("http://api.wordpress.org/core/credits/1.1/?version={$wp_version}&locale={$locale}");
        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;
}