wp_get_translation_updates() WordPress Function

The wp_get_translation_updates() function is used to check if there are any translation updates available for the current site. This function will return an array of translation updates if there are any available, or an empty array if there are none.

wp_get_translation_updates() #

Retrieves a list of all language updates available.


Return

(object[]) Array of translation objects that have available updates.


Top ↑

Source

File: wp-includes/update.php

function wp_get_translation_updates() {
	$updates    = array();
	$transients = array(
		'update_core'    => 'core',
		'update_plugins' => 'plugin',
		'update_themes'  => 'theme',
	);

	foreach ( $transients as $transient => $type ) {
		$transient = get_site_transient( $transient );

		if ( empty( $transient->translations ) ) {
			continue;
		}

		foreach ( $transient->translations as $translation ) {
			$updates[] = (object) $translation;
		}
	}

	return $updates;
}


Top ↑

Changelog

Changelog
VersionDescription
3.7.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.