1

I have registered custom commands that scaffording some files. These commands don't rely on any wordpress funcionality, basically outputs some files with content (what commands do is irrelevant in this problem, so I won't paste here any code).

Example command: wp make:some file

When I run these command when Wordpress is installed everything works perfectly, but if there is no Wordpress wp-cli alerts with:

Error: This does not seem to be a WordPress install.
Pass --path=`path/to/wordpress` or run `wp core download`.

There is any way to run that commands without active Wordpress installation present?

2 Answers 2

0

This may be helpful.

http://wp-cli.org/blog/how-wp-cli-loads-wordpress.html

This is what actually wp-cli tries.

$_SERVER['HTTP_HOST'] = 'example.com';
define('WP_ADMIN', true);
require('wordpress/wp-load.php');

You must have these WordPress files files and the database. So the answer is NO unless you create hack. I am not aware of any.


If you pass:

$ wp make:a.txt --skip-wordpress
Error: This does not seem to be a WordPress install.
Pass --path=`path/to/wordpress` or run `wp core download`.

wp --version
WP-CLI 0.23.1
0

You can run your command with --skip-wordpress to avoid loading WordPress as part of the command run. See here.

There is also @when before_wp_load, at the same link above, but I'm not entirely sure that will work for you use case.

1
  • I find it too, but unfortunatlly it is only part of eval and eval-file commands. This not fits in my case very well :( May 19, 2016 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.