admin管理员组文章数量:1130349
This function is in plugin.php file in wordpress core. I read the code and didn't get quietly what does it do. Can anyone give some explanation for this function?
This function is in plugin.php file in wordpress core. I read the code and didn't get quietly what does it do. Can anyone give some explanation for this function?
Share Improve this question asked Jan 3, 2019 at 14:50 MahdiMahdi 292 bronze badges 3- 1 It activates a plugin, as you'd expect, what more do you need to know? – Jacob Peattie Commented Jan 3, 2019 at 14:56
- I want to know the mechanism of it – Mahdi Commented Jan 3, 2019 at 20:56
- I also want to know; it's ambiguous. what's a "silent" activation? – bozdoz Commented May 10, 2023 at 1:41
1 Answer
Reset to default 0Sometimes the easiest way is to go to docs...
Attempts activation of plugin in a "sandbox" and redirects on success.
A plugin that is already activated will not attempt to be activated again.
The way it works is by setting the redirection to the error before trying to include the plugin file. If the plugin fails, then the redirection will not be overwritten with the success message. Also, the options will not be updated and the activation hook will not be called on plugin error.
It should be noted that in no way the below code will actually prevent errors within the file. The code should not be used elsewhere to replicate the "sandbox", which uses redirection to work.
If any errors are found or text is outputted, then it will be captured to ensure that the success redirection will update the error redirection.
This function is in plugin.php file in wordpress core. I read the code and didn't get quietly what does it do. Can anyone give some explanation for this function?
This function is in plugin.php file in wordpress core. I read the code and didn't get quietly what does it do. Can anyone give some explanation for this function?
Share Improve this question asked Jan 3, 2019 at 14:50 MahdiMahdi 292 bronze badges 3- 1 It activates a plugin, as you'd expect, what more do you need to know? – Jacob Peattie Commented Jan 3, 2019 at 14:56
- I want to know the mechanism of it – Mahdi Commented Jan 3, 2019 at 20:56
- I also want to know; it's ambiguous. what's a "silent" activation? – bozdoz Commented May 10, 2023 at 1:41
1 Answer
Reset to default 0Sometimes the easiest way is to go to docs...
Attempts activation of plugin in a "sandbox" and redirects on success.
A plugin that is already activated will not attempt to be activated again.
The way it works is by setting the redirection to the error before trying to include the plugin file. If the plugin fails, then the redirection will not be overwritten with the success message. Also, the options will not be updated and the activation hook will not be called on plugin error.
It should be noted that in no way the below code will actually prevent errors within the file. The code should not be used elsewhere to replicate the "sandbox", which uses redirection to work.
If any errors are found or text is outputted, then it will be captured to ensure that the success redirection will update the error redirection.
本文标签: pluginsexplanation for activateplugin function in wordpress core
版权声明:本文标题:plugins - explanation for activate_plugin function in wordpress core 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749048314a2308212.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论