Language_Pack_Upgrader::get_name_for_update() WordPress Method

The Language_Pack_Upgrader::get_name_for_update() method is used to get the name of a language pack for an update.

Language_Pack_Upgrader::get_name_for_update( object $update ) #

Get the name of an item being updated.


Parameters

$update

(object)(Required)The data for an update.


Top ↑

Return

(string) The name of the item being updated.


Top ↑

Source

File: wp-admin/includes/class-language-pack-upgrader.php

	public function get_name_for_update( $update ) {
		switch ( $update->type ) {
			case 'core':
				return 'WordPress'; // Not translated.

			case 'theme':
				$theme = wp_get_theme( $update->slug );
				if ( $theme->exists() ) {
					return $theme->Get( 'Name' );
				}
				break;
			case 'plugin':
				$plugin_data = get_plugins( '/' . $update->slug );
				$plugin_data = reset( $plugin_data );
				if ( $plugin_data ) {
					return $plugin_data['Name'];
				}
				break;
		}
		return '';
	}


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.