admin管理员组文章数量:1122846
Is there an action hook when a new plugin is installed?
I want to hook into the moment when a new plugin was put into the /wp-content/plugins
folder. So really just adding the plugin (either via upload or via installation through the admin interface to pick plugins for installation).
Please note I am not referring to the activation of a plugin (activated_plugin
does that trick).
Is there an action hook when a new plugin is installed?
I want to hook into the moment when a new plugin was put into the /wp-content/plugins
folder. So really just adding the plugin (either via upload or via installation through the admin interface to pick plugins for installation).
Please note I am not referring to the activation of a plugin (activated_plugin
does that trick).
- There's no hook for that that I know of. hookr.io is pretty useful for browsing all of the hooks at once. – admcfajn Commented Jan 10, 2022 at 22:57
- 1 you would need to check for this on every single request and then fire a hook yourself to catch when someone drops a plugin in that folder via FTP or other means, which could be costly. You'd also need to maintain a list. What's the reason for wanting to do this? What are you trying to do that requires it? – Tom J Nowell ♦ Commented Jan 11, 2022 at 0:44
- Is it your plugin that you can code? – brothman01 Commented Jan 11, 2022 at 18:39
- There is a need for a server-side script, nothing to do with WordPress. – Max Yudin Commented Jan 11, 2022 at 21:38
- @TomJNowell Adding folders via FTP is out of scope. I am only concerned what WordPress offers via the admin UI. So the package upload and "online install" from the WP.org repo. I had hoped I can get an info for that cases. – hbit Commented Jan 11, 2022 at 22:24
1 Answer
Reset to default 0I think it's a bit tricky but using https://developer.wordpress.org/reference/hooks/plugin_loaded/ to know if the plugin has just been activated.
I think check if a plugin is added to get_option('active_plugins');
And doing your stuff when you detect something new
本文标签: ActionHook when a new plugin is added
版权声明:本文标题:ActionHook when a new plugin is added 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736292713a1928993.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论