Skip to content

Add flag to treat command as not WP_ADMIN. #351

@thanj

Description

@thanj

I found myself this week trying to use WP-CLI for some front-end unit-testing, trying to pass a path to the script using the "url" parameter, and inspect the scripts enqueued for that query using my custom command.

I was stuck, though, because the WP_CLI\Runner::before_wp_load() includes the constant definition define( 'WP_ADMIN', true );. Changing that definition to false was enough for my purposes here.

I know that a lot more would need to be built out to actually allow WP_CLI to mock up a front end page load, use the template loader, and so on, but for now, adding a flag to run the current command with WP_ADMIN = false seems like it would be helpful?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions