This page is an overview of the WP-CLI. It is very powerful tool to be able to generate content truely at the speed of thought.
I found this plugin that allows me to add indexes to to pages or posts. I am going to use this to create these organizational pages about different categories of information.
Posts Regarding The WP-CLI
Installing WP-CLI ↑
Here is the main website for the WP-CLI
First get the Phar file
|
1 2 3 |
// // wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar |
Now check that it is working:
|
1 2 3 |
// // php wp-cli.phar --info |
|
1 2 3 4 |
// // chmod +x wp-cli.phar sudo mv wp-cli.phar /usr/local/bin/wp |
Now check that WP-CLI was successfully installed
|
1 2 3 |
// // wp --info |
Updating WP-CLI ↑
This is more complicated than it should be
|
1 2 3 4 5 6 7 8 9 10 11 12 |
// //You should be able to just do this wp cli update // But that will give you the following error Error: /usr/local/bin is not writable by current user. // So you have to do sudo wp cli update // But that will give you a path error like this /usr/bin/env: php: No such file or directory |
I can not stress enough how frustrating it has been to figure out this issue.
You should not assume that the $PATH variable set by the currently logged in
user is the one that the sudoers are going to use. The “sudo” command uses
a “secure_path”. You can see the two paths like this:
You should not assume that the $PATH variable set by the currently logged in
user is the one that the sudoers are going to use. The “sudo” command uses
a “secure_path”. You can see the two paths like this:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
// // env | grep ^PATH sudo env | grep ^PATH // Sudo might be overriding your path. // If you would like to see if the "secure_path" do this: sudo -V | grep 'Value to override' // This will give you the "secure_path" Value to override user's $PATH with: /sbin:/bin:/usr/sbin:/usr/bin // If this is the case you can always edit "/etc/sudoers" like this: visudo //or vim /etc/sudoers // You can force sudo to use the path that you choose like this: sudo -E env "PATH=$PATH" wp cli update |
I have found this control over the sudo path to be extreamly useful so I made a alias for it like this:
|
1 2 3 4 5 6 |
// // // Make sure this file exists touch /etc/profile.d/00-aliases.sh // Add this alias to it sed -i "$ a alias mysudo=\'sudo -E env \"PATH=\$PATH\"\' " /etc/profile.d/00-aliases.sh |
Now every time you want to make sure “sudo” uses your current path all you need to do is use “mysudo” like this:
|
1 2 3 4 5 6 |
// // so instead of having to remember and type this sudo -E env "PATH=$PATH" wp cli update // You can now do mysudo wp cli update |
This is the WP-CLI_Index-Page.txt Id has PostId of 5123