admin管理员组文章数量:1391860
i want use this function to take some info, but how can i take the data i need? for example for wp_get_data() i do this
$example = wp_get_update_data();
echo $example ['title'];
or
echo $example['count']['plugins'];
and it print the data i wanted. and for get_plugin_updates() don't work call what i need. i want echo name-plugin | actual version |update version
i want use this function to take some info, but how can i take the data i need? for example for wp_get_data() i do this
$example = wp_get_update_data();
echo $example ['title'];
or
echo $example['count']['plugins'];
and it print the data i wanted. and for get_plugin_updates() don't work call what i need. i want echo name-plugin | actual version |update version
Share Improve this question asked Feb 6, 2020 at 19:23 BeppeBeppe 31 bronze badge 2- This is the sixth time you've posted a variation of this question in 2 days. If you have something to add, edit the existing question. If it's urgent, and you're not getting a satisfactory answer, you might want to consider hiring someone. Otherwise please wait for an answer, and stop posting the same question again and again. – Jacob Peattie Commented Feb 6, 2020 at 23:15
- I don't know... – Beppe Commented Feb 7, 2020 at 12:52
1 Answer
Reset to default 0Welcome.
The function returns an array of all possible updates. Means that you need to specify the plugin that you need to get its information.
Sample output of get_plugin_updates
call on admin_init
:
array(1) {
["fast-velocity-minify/fvm.php"]=>
object(stdClass)#7844 (14) {
["Name"]=>
string(20) "Fast Velocity Minify"
["PluginURI"]=>
string(23) "http://fastvelocity"
["Version"]=>
string(5) "2.7.7"
["Description"]=>
string(192) "Improve your speed score on GTmetrix, Pingdom Tools and Google PageSpeed Insights by merging and minifying CSS and JavaScript files into groups, compressing HTML and other speed optimizations."
["Author"]=>
string(12) "Raul Peixoto"
["AuthorURI"]=>
string(23) "http://fastvelocity"
["TextDomain"]=>
string(20) "fast-velocity-minify"
["DomainPath"]=>
string(0) ""
["Network"]=>
bool(false)
["RequiresWP"]=>
string(0) ""
["RequiresPHP"]=>
string(0) ""
["Title"]=>
string(20) "Fast Velocity Minify"
["AuthorName"]=>
string(12) "Raul Peixoto"
["update"]=>
object(stdClass)#7799 (12) {
["id"]=>
string(34) "w/plugins/fast-velocity-minify"
["slug"]=>
string(20) "fast-velocity-minify"
["plugin"]=>
string(28) "fast-velocity-minify/fvm.php"
["new_version"]=>
string(5) "2.7.8"
["url"]=>
string(51) "https://wordpress/plugins/fast-velocity-minify/"
["package"]=>
string(69) "https://downloads.wordpress/plugin/fast-velocity-minify.2.7.8.zip"
["icons"]=>
array(1) {
["1x"]=>
string(73) "https://ps.w/fast-velocity-minify/assets/icon-128x128.jpg?rev=1440946"
}
["banners"]=>
array(1) {
["1x"]=>
string(75) "https://ps.w/fast-velocity-minify/assets/banner-772x250.jpg?rev=1440936"
}
["banners_rtl"]=>
array(0) {
}
["tested"]=>
string(5) "5.3.2"
["requires_php"]=>
string(3) "5.6"
["compatibility"]=>
object(stdClass)#7800 (0) {
}
}
}
}
So you need to specify the plugin before getting its name. You need to change the code to something like the following one:
$plugin_updates = get_plugin_updates();
// Print plugin name.
echo ['my-plugin/my-plugin.php']->Name;
// Print plugin update version.
echo ['my-plugin/my-plugin.php']->update->new_version;
本文标签: pluginsHow use getpluginupdates() function
版权声明:本文标题:plugins - How use get_plugin_updates() function? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744770753a2624323.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论