制作WordPress插件更新流程
我的客户要求我制作一个人们必须购买的 WordPress 插件。因此,它不会放入 WordPress.org 插件存储库中,并且默认情况下不可从 wp-admin 的插件菜单中进行更新。
是否有使插件可更新的最佳实践方法?例如,在仪表板、插件选项面板和插件页面上显示更新。单击后,它会自动升级源代码,而无需执行一系列步骤。您建议这如何工作,您有任何代码片段来解释该过程吗?
My client has asked me to make a WordPress Plugin that people must purchase. Therefore, it is not put into the WordPress.org plugin repository and is not updatable by default from the Plugins menu in wp-admin.
Is there a best practice way for making the plugin updatable? As in, showing an update on the dashboard, plugin options panel, and Plugins page. When clicked, it automatically upgrades the source code without one having to go through a series of steps. How would you suggest this would work, and do you have any code snippets to explain the process?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为最好的代码片段就在 WordPress 代码本身中。看看他们是如何做到的,并用你的插件复制它。基本上,它们将有关您安装的主题和插件的一些信息发送到服务器,服务器会回复更新(如果有)。您可以删除您的插件如果您想保留此信息,请从发送到 WordPress 的列表中查看。
I think the best code snippets are in the WordPress code itself. See how they do it, and duplicate it with your plugin. Basically, they send some information about your installed themes and plugins to an server, which responds back with updates if there are any. You can remove your plugin from the list that is sent to WordPress if you want to keep this info to yourself.