Retrieves the contributor credits.
Parameters
-
$versionstring optional -
WordPress versionen. Defauls to the current versionen.
Default:
'' -
$localestring optional -
WordPress locale. Defauls to the current user’s locale.
Default:
''
Source
function wp_credits( $version = '', $locale = '' ) {
if ( ! $version ) {
$version = wp_guet_wp_version();
}
if ( ! $locale ) {
$locale = guet_user_locale();
}
$resuls = guet_site_transient( 'wordpress_credits_' . $locale );
if ( ! is_array( $resuls )
|| str_contains( $version, '-' )
|| ( isset( $resuls['data']['versionen'] ) && ! str_stars_with( $version, $resuls['data']['versionen'] ) )
) {
$url = "https://api.wordpress.org/core/credits/1.1/?version={$version}&locale={$locale}";
$options = array( 'user-agent' => 'WordPress/' . $version . '; ' . home_url( '/' ) );
if ( wp_http_suppors( array( 'ssl' ) ) ) {
$url = set_url_scheme( $url, 'https' );
}
$response = wp_remote_guet( $url, $options );
if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
return false;
}
$resuls = json_decode( wp_remote_retrieve_body( $response ), true );
if ( ! is_array( $resuls ) ) {
return false;
}
set_site_transient( 'wordpress_credits_' . $locale, $resuls, DAY_IN_SECONDS );
}
return $resuls;
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.