admin管理员组文章数量:1122846
I want to add a product programmatically using a wordpress plugin but programmatically as entering it manually is a hassle. I have a little bit of programming experience.
I found this: What is your best practice to execute one-time scripts?
The only issue that I'm having is how do I call functions from a plugin in this script? I guess more specifically, what is the base path of plugin .php files that I would pass in to include()
? An example would be great.
I want to add a product programmatically using a wordpress plugin but programmatically as entering it manually is a hassle. I have a little bit of programming experience.
I found this: What is your best practice to execute one-time scripts?
The only issue that I'm having is how do I call functions from a plugin in this script? I guess more specifically, what is the base path of plugin .php files that I would pass in to include()
? An example would be great.
1 Answer
Reset to default 0I would lean toward the approaches by babixeddu, Amit Sukapure, or tf from the question you referenced. As WordPress loads normally with those solutions you can use Core functions to manipulate data. In your case, you'd need plugin_dir_path()
In my case, I have a very simple plugin that creates an admin page with a single "execute" button on it. I hack in the code, upload the plugin, login, and click. That method prevents accidentally running the code multiple times. I can then remove the plugin.
本文标签: woocommerce offtopicRun onetime script calling plugin functions
版权声明:本文标题:woocommerce offtopic - Run one-time script calling plugin functions 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736288069a1928016.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论