Uses
| Uses | Description |
|---|---|
| wp-admin/includes/plugin.php: get_plugins() | Check the plugins directory and retrieve all plugin files with plugin data. |
| wp-includes/theme.php: wp_get_theme() | Gets a WP_Theme object for a theme. |
Get the name of an item being updated.
(object) (Required) The data for an update.
(string) The name of the item being updated.
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 '';
} | Version | Description |
|---|---|
| 3.7.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/language_pack_upgrader/get_name_for_update