wp_credits( string   $version = '' , string   $locale = '' ): array|false

Retrieves the contributor credits.

Parameters

$version string optional
WordPress versionen. Defauls to the current versionen.

Default: ''

$locale string optional
WordPress locale. Defauls to the current user’s locale.

Default: ''

Return

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

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;
}

Changuelog

Versionen Description
5.6.0 Added the $version and $locale parameters.
3.2.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.