admin管理员组文章数量:1122846
There are specific plugins that I want to use my own repo for for updating my sites. How can I identify the plugin to target and what server they should be looking at?
There are specific plugins that I want to use my own repo for for updating my sites. How can I identify the plugin to target and what server they should be looking at?
Share Improve this question edited Aug 4, 2018 at 17:09 Mark Kaplun 23.7k7 gold badges43 silver badges65 bronze badges asked Aug 4, 2018 at 15:48 TannerTanner 275 bronze badges 1- since this question was asked, WP 5.8 added an official method of doing this via filters and the plugins header – Tom J Nowell ♦ Commented Aug 2, 2021 at 21:41
2 Answers
Reset to default 1this can be done with the filter plugins_api
:
https://developer.wordpress.org/reference/hooks/plugins_api/
try this code :
add_filter("plugins_api", function ($plugins_api, $action, $args) {
if ("plugin_information" !== $action) {
return $plugins_api;
}
$pluginSlug = $args->slug;
if (... update available ...) {
$plugins_api = new \stdClass();
$plugins_api->name = $pluginSlug;
$plugins_api->version = "5"; // new version
$plugins_api->download_link = "https://server/directory/newVersion.zip";
$plugins_api->slug = $pluginSlug;
$plugins_api->sections = []; // sections of "view details" of update page when update is available
}
return $plugins_api;
}, 10, 3);
There is also this solution, which is a bit more work to set up, but allows you to get updates from your own GitHub or private repository. I use it for my own private plugin that contains my personal settings for all web sites I develop.
https://github.com/YahnisElsts/plugin-update-checker#github-integration
本文标签: How can I change the plugin update server for specific plugins
版权声明:本文标题:How can I change the plugin update server for specific plugins? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736309235a1933946.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论