- wp eval
- wp db
wp eval : execute php code
Using wp eval command we can execute any php code, we have to provide the code as string.

This command also loads the wordpress core, we can skip that and not load it using the option –skip-wordpress

Above command runs even when we don’t have the WordPress installed
wp eval-file
Similar to wp eval, we can use wp eval-file , to execute php code.
Instead of giving it a string, we can provide filepath and it will run it.

These commands are helpful when we have to quickly run some files
wp db : for database operations
The wp db command can be used to perform operations on the database.
We can create new database, drop existing database or even run a query from a sql file on the database.
To connect with the database it uses wp-config.php file, so we have to put our db username passwords.
wp db cli
Using this command we can open the mysql cli and perform the operations from there.
Leave a Reply