entity-command
entity-command copied to clipboard
`wp user create` ignores the `user_url` argument
Hi,
When using command line wp create user with --user_url argument, the value is ignored.
Step to reproduce :
/usr/bin/php /usr/local/bin/wp-cli --path='/path/to/wordpress/' user create 'testurl' '[email protected]' --role='editor' --user_pass='strong_password' --first_name='first' --last_name='last' --user_url='http://www.testsite.com' --debug
No error reported in debug.
Then :
/usr/local/bin/wp-cli --path='/path/to/wordpress/' user get testurl --fields=user_url
Return empty value instead of http://www.testsite.com
Hi @kevin75001,
in your example you set --site_url, not --user_url.
Oh sorry, this is a wrong copy/past from test command.
Using --site_url produce error that option don't exist, so the problem is when using the correct --user_url, i edit my first post to give a correct way to reproduce
Thanks for the report, @kevin75001 !
I've confirmed the bug:
$ wp user create 'testurl' '[email protected]' --role='editor' --user_pass='strong_password' --first_name='first' --last_name='last' --user_url='http://www.testsite.com' --debug
Success: Created user 2.
$ wp user get testurl --fields=user_url
+----------+-------+
| Field | Value |
+----------+-------+
| user_url | |
+----------+-------+
It looks like each of the attributes are handled individually, and user_url is missing from the list:
https://github.com/wp-cli/entity-command/blob/66bdeae488a8f7c96e8200e62d54c159c1129062/src/User_Command.php#L403-L409
If you'd like, feel free to submit a pull request with tests to fix!
I can tackle this one.