开发者 |
burlingtonbytes
gschoppe |
---|---|
更新时间 | 2018年10月23日 04:34 |
PHP版本: | 4.6 及以上 |
WordPress版本: | 4.9 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
/wp-content/plugins/plugin-name
directory, or install the plugin through the WordPress plugins screen directly.There are many times running on page load is not the best option:
There are many caveats to taking this approach, but mostly it just leaves you writing a lot of (probably insecure) code. To build a custom script properly, you need to:
We love WP-CLI, but sometimes the command line is just not the right tool for the job. Often you can't get WP-CLI on shared hosts, and users who may need to use the utilities may not be comfortable with the command line. But stay tuned, WP-CLI integration is on our roadmap.
The most common answer is feature completion and ease of access. A utility script can contain as little as 17 lines of overhead, before you are free and clear to write whatever you need. We dare you to find a lighter-weight, more feature-complete option. We wrote WP Utility Script Runner because there wasn't one.
Technically, yes, but you'll be sacrificing a lot of features. You can write your utility in "legacy mode", where it can be written as simply as:
<?php
// Utility Name: My Legacy Utility
// Description: An example of a legacy utility
echo "Hello World"; // your custom code goes here
You will not get native handling for inputs, files, state, downloads, or error output, but it is pretty darn short.
Most of the time, we find that Utility Scripts are very custom to the specific site and hosting environment. We have plans to build a library of useful scripts, but for now, we just included a couple examples to help you get started writing your own.
While that's not exactly a question, we do take bug reports and reviews very seriously. In addition, you can always contact us directly with your thoughts, at support@burlingtonbytes.com.