Skip to content

Conversation

@caseydriscoll
Copy link
Contributor

@caseydriscoll
Copy link
Contributor Author

This solution doesn't work.

Fatal error: Class 'WP_CLI' not found in /srv/www/prism/htdocs/wp-content/plugins/posts-to-posts/command.php on line 3

Not sure how best to do this, will think it over.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to:

if ( defined( 'WP_CLI' ) && WP_CLI ) {
    require_once dirname( __FILE__ ) . '/command.php';
}

@danielbachhuber
Copy link
Contributor

You can also use command.php without the code change by doing:

wp --require=command.php p2p

@caseydriscoll
Copy link
Contributor Author

Yeah that might be better. If I get the time I'll update the docs.

I added a class_exists check that works, but I'll leave it @scribu

scribu pushed a commit that referenced this pull request Oct 22, 2015
Add include to command.php so WP-CLI commands are registered
@scribu scribu merged commit 33c5363 into scribu:master Oct 22, 2015
@scribu scribu added this to the 1.6.6 milestone Oct 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants