• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » WP-CLI Tips and Tricks

By Abhishek Ghosh October 9, 2022 9:05 pm Updated on October 9, 2022

WP-CLI Tips and Tricks

Advertisement

If you’re a WordPress user, chances are you’ve heard of WP-CLI. For those who don’t know, WP-CLI is a set of command-line tools for managing WordPress sites. It can be used for everything from installing and updating plugins to creating and managing users. In this post, we’re going to explore some tips and tricks for using WP-CLI to manage your WordPress site. From basic commands to more advanced usage, we hope you find this post helpful in streamlining your workflow.

 

Why Use WP-CLI?

 

Because we can automate by using bash scripts and cron. Also, CLI and TUI are often faster than loading via web UI.

WP-CLI provides a set of commands that are equivalent to the WordPress dashboard. For example, the “plugin” command allows you to manage plugins from the command line. The “theme” command allows you to manage themes from the command line.

Advertisement

---

In addition to the core set of commands, WP-CLI also provides a set of community-developed commands. These commands are not part of the core WP-CLI project but are developed by members of the community and made available for use via the wp CLI package manager (CPM).

 

How to Install WP-CLI

 

Before you begin, you will need to have SSH access to your hosting account. In other words, you need to have your WordPress website running at least on a cheap VPS such as VPSDime. Of course, you can run your site on DigitalOcean, Linode, AWS or a dedicated server. Make sure you are in a UNIX-like environment (OS X, Linux, FreeBSD, Cygwin) with PHP 5.6 or later, and WordPress 3.7 or later.

Vim
1
2
3
4
5
6
7
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
## cd /usr/local/bin/wp
## mkdir /usr/local/bin/wp
sudo mv wp-cli.phar /usr/local/bin/wp
wp --info

It is easy to install WP-CLI.

WP-CLI Tips and Tricks

 

Tips and Tricks for Using WP-CLI

 

If you’re a WordPress developer, then you know that the command line can be a powerful tool. And if you’re looking for a way to speed up your workflow, then WP-CLI is worth investing the time.

The wp help and wp help command-name (where command-name is a real command name, such as comment, or post) will give you an excerpt of what you can do. There are a few utilities in the official WP-CLI Github repository:

Vim
1
https://github.com/wp-cli/wp-cli/tree/master/utils

One of the useful utilities is tab completion. wget the file and add the line on your profile file:

Vim
1
2
# wget https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash
source /PATH/TO/wp-completion.bash

You can do scaffold theme tests with WP-CLI :

Vim
1
2
3
wp scaffold theme-tests your-theme-name
cd your-theme-name
phpunit

tests/ will contains PHPUnit-specific files. bin/install-wp-tests.sh is a setup script. .travis.yml is useful on GitHub to run Travis tests. Original doc:

Vim
1
https://developer.wordpress.org/cli/commands/scaffold/theme-tests/

By typing wp shell, you can start an interactive session to evaluate PHP statements and expressions. Here is the official doc :

Vim
1
2
https://developer.wordpress.org/cli/commands/shell/
https://github.com/wp-cli/shell-command

I have forked a repo on some of the commonly used commands which may help you more:

Vim
1
https://github.com/AbhishekGhosh/wp-cli-tips

With WP-CLI and cron, you can use bash scripts to periodically delete the transients.

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to WP-CLI Tips and Tricks

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • Changing Data With cURL for OpenStack Swift (HP Cloud CDN)

    Changing Data With cURL For Object is Quite Easy in OpenStack Swift. Here Are Examples With HP Cloud CDN To Make it Clear. Official Examples Are Bad.

  • OpenShift OctoPress Auto install Script

    OpenShift OctoPress Auto install Script is an Advanced Script to Run OctoPress on Free OpenShift PaaS Practically Without Any Knowing Ruby or Git.

  • OpenStack Swift & HPCloud CDN PHP Bindings : Basics

    Here is the basics of OpenStack Swift & HPCloud CDN PHP Bindings for the WordPress Plugin developers and those who works with PHP based CMS.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • PowerAmp Settings for Higher Sound QualityOctober 4, 2023
  • Affordable Earphone/IEM for Audiophiles: HiFiMan RE-400 WaterlineOctober 2, 2023
  • What is Hardware Security Module (HSM)September 30, 2023
  • Transducer Technologies of HeadphonesSeptember 28, 2023
  • What is Analog-to-Digital Converter (ADC)September 27, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy