admin管理员组文章数量:1406001
I want to create a custom WP CLI command and I have read the documentation but I just don't understand for the life of me how this works.
Do I need to declare it before in my config file where they are gonna go?
Is it a PHP file? If so, I need to declare it put it anywhere inside my theme?
Thank you in advance.
I want to create a custom WP CLI command and I have read the documentation but I just don't understand for the life of me how this works.
Do I need to declare it before in my config file where they are gonna go?
Is it a PHP file? If so, I need to declare it put it anywhere inside my theme?
Thank you in advance.
Share Improve this question asked Nov 28, 2019 at 0:09 Marco BerrocaMarco Berroca 633 bronze badges 1- 1 there is a chapter "Extending" here github/wp-cli/wp-cli/#extending – Kaperto Commented Nov 28, 2019 at 0:23
1 Answer
Reset to default 1You can put the PHP anywhere in your plugin, or a file that's included into your plugin, the same as you would any other code for extending any part of WordPress in a plugin. The only thing you need to do is check that WP_CLI
exists before using any of the WP CLI API:
if ( defined( 'WP_CLI' ) && WP_CLI ) {
// WP_CLI::add_command etc.
}
本文标签: wp cliWhere do the files of a custom WP CLI Command reside
版权声明:本文标题:wp cli - Where do the files of a custom WP CLI Command reside? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744961151a2634662.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论