admin管理员组

文章数量:1193313

According to WP-CLI documentation, you can specify "user" using inline arguments, or in the global configuration.

I understand there might be a task you want to run against a specific WordPress user, but what is the purpose of having a default WordPress user specificied in wp-cli.yml exactly? If anything, it seems a bit risky, or confusing.

Furthermore, why is user: admin recommended as a default value? That username hasn't been default in WordPress for several years already... are there security or usability concerns with defining this global option, esp. depending on various web hosting environments that may or may not include user-level wp-cli.yml files?

According to WP-CLI documentation, you can specify "user" using inline arguments, or in the global configuration.

I understand there might be a task you want to run against a specific WordPress user, but what is the purpose of having a default WordPress user specificied in wp-cli.yml exactly? If anything, it seems a bit risky, or confusing.

Furthermore, why is user: admin recommended as a default value? That username hasn't been default in WordPress for several years already... are there security or usability concerns with defining this global option, esp. depending on various web hosting environments that may or may not include user-level wp-cli.yml files?

Share Improve this question asked Aug 7, 2022 at 17:18 Jesse NicklesJesse Nickles 7357 silver badges19 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

There's a difference between doing things to a user, and doing things as a user.

E.g. when you are logged in you are the current user, but by default in WP CLI there is no "current user". You can specify this via a parameter but adding a user via wp-cli.yml saves time. You may even create a dedicated alias for running commands as that user.

Furthermore, why is user: admin recommended as a default value? That username hasn't been default in WordPress for several years already... are there security or usability concerns with defining this global option, esp. depending on various web hosting environments that may or may not include user-level wp-cli.yml files?

There's been a misunderstanding, admin is used as an example, not as a recommendation. The documentation is not telling you to use the value admin or suggesting its best practice. Rather it's providing an example so that people who want to use this option have an example they can compare against.

It's not telling you to use admin, it's saying if you wanted to use user with a value e.g. admin, that's what it would look like. You can see other uses of the user directive further down.

are there security or usability concerns with defining this global option

If you have WP CLI access then it does not matter what the user parameter says, access has already been compromised, it's already game over. This is like asking if the shape of the buttons on your personal safe matter to burglars, after all WP CLI provides many other options, as well as --user.

but what is the purpose of having a default WordPress user specificied in wp-cli.yml exactly? If anything, it seems a bit risky, or confusing.

Then don't specify a default user, most people do not do this, it requires additional steps. Most people don't have a config file in the first place when using WP CLI. It's simply an option that is available if it's convenient.

本文标签: wp cliWhat is the purpose of the quotuserquot global parameter in wpcliyml config