Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Manage WordPress Easily With WP-CLI

C50127bc268f96d5ffa72f47d72bf799?s=47 Ajit Bohra
November 05, 2017

Manage WordPress Easily With WP-CLI

Workshop at WordCamp Nashik 2017, Ajit Bohra, Hardeep Asrani & Gagan Deep Singh

C50127bc268f96d5ffa72f47d72bf799?s=128

Ajit Bohra

November 05, 2017
Tweet

Transcript

  1. Manage WordPress Easily with WP-CLI Ajit Bohra, Hardeep Asrani &

    Gagan Deep Singh
  2. How many of you are Command Line users?

  3. How many of you are using WP-CLI?

  4. What is WP-CLI?

  5. Why not WP-CLI?

  6. Which one was easier?

  7. Expectations & Takeaways

  8. Let’s get started!

  9. Install WP-CLI # Install WP-CLI $ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
 #

    Make the file executable
 $ chmod +x wp-cli.phar
 # Move it to somewhere in your PATH
 $ sudo mv wp-cli.phar /usr/local/bin/wp # Test WP-CLI. $ wp —info Source: wp-cli.org
  10. Command Structure $ wp plugin install wordpress-seo - -activate command

    subcommand parameter flag
  11. Useful Commands

  12. Plugin Commands: Install & Activate $ wp plugin install bbpress

    - -activate
  13. Plugin Commands: Deactivate $ wp plugin deactivate bbpress

  14. Plugin Commands: Delete $ wp plugin delete bbpress

  15. Theme Commands: Install & Activate $ wp theme install make

    - -activate
  16. Theme Commands: Deactivate $ wp theme deactivate make

  17. Theme Commands: Delete $ wp theme delete make

  18. Manage Users: List Users $ wp user list

  19. Manage Users: Create User $ wp user create harry ex@ample.com

    - -role=author
  20. Manage Users: Change Password $ wp user create bob bob@example.com

    --role=author
  21. Manage Users: Delete User $ wp user delete 10

  22. Manage Media: Upload Media $ wp media import https://example.com/image.png

  23. Manage Media: Regenerate Media $ wp media regenerate - -yes

  24. Manage Posts: Create Posts $ wp post create --post_type=page --post_title='A

    sample post'
  25. Manage Posts: Edit Posts $ wp post edit 123

  26. Manage Posts: Generate Posts $ wp post generate --count=10 --post_type=page

    --post_date=1999-01-04
  27. Export/Import Posts: Generate Posts $ wp export

  28. Export/Import Posts: Generate Posts $ wp import example.wordpress.2016-06-21.xml --authors=create

  29. Search/Replace $ wp search-replace ‘http://old-site.com' ‘http://new-site.com'

  30. Now it’s your time.

  31. Resources http://wp-cli.org/ https://developer.wordpress.org/cli/commands/ https://local.getflywheel.com/ https://commandlinepoweruser.com/ https://serversforhackers.com/ https://mediatemple.net/community/products/dv/204403684/ connecting-via-ssh-to-your-server

  32. Thank you.