admin管理员组文章数量:1293635
I want to run the command : "composer install --prefer-dist" in a wordpress plugin in the hook register_activation_hook to install the require vendors. But when I trying to activating the plugin the error below is generate. Do you have a way to install the required composers when activate the plugin?
Fatal error: Uncaught Error: Class 'App\XXXXX' not found in /../wordpress/wp-content/plugins/my-plugin/my-plugin.php:54 Stack trace: #0 /../wordpress/wp-admin/includes/plugin.php(2300): include() #1 /../wordpress/wp-admin/plugins.php(191): plugin_sandbox_scrape('my-plugin/my-...') #2 {main} thrown in /../wordpress/wp-content/plugins/my-plugin/my-plugin.php on line 54
I want to run the command : "composer install --prefer-dist" in a wordpress plugin in the hook register_activation_hook to install the require vendors. But when I trying to activating the plugin the error below is generate. Do you have a way to install the required composers when activate the plugin?
Share Improve this question asked Apr 30, 2021 at 1:32 CMHCMH 31 bronze badgeFatal error: Uncaught Error: Class 'App\XXXXX' not found in /../wordpress/wp-content/plugins/my-plugin/my-plugin.php:54 Stack trace: #0 /../wordpress/wp-admin/includes/plugin.php(2300): include() #1 /../wordpress/wp-admin/plugins.php(191): plugin_sandbox_scrape('my-plugin/my-...') #2 {main} thrown in /../wordpress/wp-content/plugins/my-plugin/my-plugin.php on line 54
1 Answer
Reset to default 1This is not how this should work. You should not be stunning shell commands from a plugin. The proper way to do this is to install dependencies before bundling for distribution.
本文标签: hooksRun command quotcomposer installquot when activating wordpress plugin
版权声明:本文标题:hooks - Run command "composer install" when activating wordpress plugin 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741585337a2386813.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论