Skip to content

Make $args available as global to match behavior of $argv and $argc #80

@kkmuffme

Description

@kkmuffme

Feature Request

Describe your use case and the problem you are facing

wp eval-file foo.php hello --skip-wordpress --use-include

In foo.php $args will be available as array containing 'hello' by default. However, when using
global $args; it will be null.
This is unintuitive, since for PHP $argv and $argc the global keyword is required, but when using this for $args it will have the opposite effect.

Describe the solution you'd like

The fix is simple by just setting global $args; before it's declared by WP-CLI.

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