It is one element of the response
Array that’s a property of the object stored in the update_plugins
or update_themes
site transient.
That transient looks like this (var_dump()
ed):
object(stdClass)#1 (4) {
["last_checked"]=>
int(1519305016)
["response"]=>
array(1) {
["akismet/akismet.php"]=>
object(stdClass)#2 (11) {
["id"]=>
string(21) "w.org/plugins/akismet"
["slug"]=>
string(7) "akismet"
["plugin"]=>
string(19) "akismet/akismet.php"
["new_version"]=>
string(5) "4.0.3"
["url"]=>
string(38) "https://wordpress.org/plugins/akismet/"
["package"]=>
string(56) "https://downloads.wordpress.org/plugin/akismet.4.0.3.zip"
["icons"]=>
array(3) {
["1x"]=>
string(59) "https://ps.w.org/akismet/assets/icon-128x128.png?rev=969272"
["2x"]=>
string(59) "https://ps.w.org/akismet/assets/icon-256x256.png?rev=969272"
["default"]=>
string(59) "https://ps.w.org/akismet/assets/icon-256x256.png?rev=969272"
}
["banners"]=>
array(2) {
["1x"]=>
string(61) "https://ps.w.org/akismet/assets/banner-772x250.jpg?rev=479904"
["default"]=>
string(61) "https://ps.w.org/akismet/assets/banner-772x250.jpg?rev=479904"
}
["banners_rtl"]=>
array(0) {
}
["tested"]=>
string(5) "4.9.4"
["compatibility"]=>
object(stdClass)#3 (0) {
}
}
}
}
So the $item
for a plugin update will look like the akismet/akismet.php
element in the response
Array, meaning you can access the version with $item->new_version
.
It is however important to note that there’s zero guarantee that plugins and themes all use the same version numbering system. For example, in a WordPress version X.Y.Z
, Y
is a major version and Z
is a minor version (and X
is just for show, apparently), but in WooCommerce X
is a major version and Y
is a minor version. Every plugin and theme could be different.