Gets the name of an item being updated.
Parameters
$update
objectrequired- The data for an update.
Source
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 '';
}
Changelog
Version | Description |
---|---|
3.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.