Fork me on GitHub
X

WordPress-kehittäjä, älä missaa ilmaista webinaariamme WordPressin hakutoiminnosta tammikuun 14. päivä!

WordPress-utvecklare, missa inte vår gratis webbinar om sökningen in WordPress den 14. januari!

WordPress developer, don't miss our free webinar about search in WordPress on January 14th!

Summary: All Seravo sites come with wp-cli preinstalled and configured for easier command-line management.

Basics

You can use wp-cli in Vagrant box and Production. Just run this to see all commands:

$ wp --help

Note: You can call wp command anywhere without --path parameter because the environment handles paths for you.

More information about wp-cli can be found in wp-cli.org

Useful commands

Database export/import (dumping db)

# Dumps the database to a provided filename
$ wp db export your-dump-filename.sql

# Imports the dump file from file
$ wp db import your-dump-filename.sql

Create user

This creates a new administrator user ‘username’ with password ‘newpassword’:

$ wp user create username email --user_pass=newpassword --role=administrator

Search-Replace database contents

After you have pulled database from production it’s useful to regex replace urls:

$ wp search-replace http://example.com http://example.test