i need to get a list of all updates the wp site need (core, plugin and themes). i already know about wp_get_update_data(), but it give me back only the number. i need to get for example:
plugin1 | actual version | new version
plugin2 | actual version | new version
theme1 | actual version | new version
wp | actual version | new version
how can i save that information into some arrays to use them?
edit: i managed to do this with what i found but it doesn't work, it print to try only test
function data_report()
{
// Get theme info
$theme_data = wp_get_theme();
$theme = $theme_data->Name . ' ' . $theme_data->Version;
// Get plugins that have an update
$updates = get_plugin_updates();
// WordPress active plugins
$fin_plug = "\n" . '-- WordPress Active Plugins' . "\n\n";
$plugins = get_plugins();
$active_plugins = get_option('active_plugins', array());
foreach ($plugins as $plugin_path => $plugin) {
if (!in_array($plugin_path, $active_plugins)) {
continue;
}
$update = array_key_exists($plugin_path, $updates) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : '';
$fin_plug .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n";
}
}
add_action( 'wp_footer', 'stampa_prova' );
function stampa_prova (){
echo 'test';
$cospi = data_report();
echo $cospi;
}