Articles of command line

wp-cli for Creating page-template

I’ve recently started using wp-cli to work on WordPress and starting to love it. However, I’m curious about creating page templates using wp-cli. I haven’t been able to find anything on it, does anyone if I can create a page template using wp-cli. I found the scaffold command but that also doesn’t have the option […]

How can I use PurifyCSS to clean WordPress style.css?

I am trying to use PurifyCSS to clean my style.css file. When I try it on static html file if works fine. See example of my CLI command: purifycss wp01/wp-content/themes/mytheme/style.css index.html –min –info But when I try to use it on live web (running on my localhost) I am getting incorrect results. Here is my […]

Get plugin download URL from slug

Is there a way to take a plugin slug (e.g. ‘akismet’) of a plugin that is NOT currently installed and somehow retrieve the download URL of the current version (e.g. ‘’)? This is for a command line script I am trying to develop that will enable plugin installation from the command line.

Database Update Required – Update from command-line

I just did upgrade my wordpress subtree of my website to the 3.6 branch and now the site tells me that I need to upgrade my database as well: Database Update Required Nothing special so far, just business as normal. It suggests me to navigate to next. As I’d like to automate the WordPress […]

Change WordPress URL in sql file via Terminal

I’ve got a 40mb database file that I’ve exported from an old host and need to import it into a new host on a new domain. I normally open up the database in my code editor and find-replace, but as this file is so big, it’s freezing my editor. Is there a way to do […]

Other than WP-CLI, is there a way to install WordPress via the command-line?

I’ve been trying to create an Ansible playbook to install WordPress. Most of the online documentation I’ve read, about installing WordPress via the command-line points to WP-CLI. Question is, aside from WP-CLI, is there a method to install WordPress via the command-line. Here’s what I’ve completed thus far: wget tar zxf latest.tar.gz fix the […]

How to run a php file that uses wordpress functions from command line?

I am using wordpress functions in a custom php file including wp-load.php, run from browser it is fine, but run from command line with php /path/.php wp-load.php causes problems: Warning: Cannot modify header information – headers already sent in /../wp-includes/ms-settings.php on line 162 code example to reproduce: echo ‘something’; require “/../wp-load.php”;

How do I set and list page_template with wpcli?

I have a page that has a new template, and I want to set that new template with wp-cli. When I wp post get <id> I get an output like the following: +———————–+———————+ | Field | Value | +———————–+———————+ | ID | 4 | | post_author | 5 | | post_date | 2012-03-09 13:11:38 | […]

Run W3 Total Cache Flush Function with Crontab

Ok. I’m really stumped on this one. Basically, I need to call a function for the WordPress plugin W3 Total Cache as part of a cron job in crontab. I’d like to automatically clear the entire page cache nightly. Here’s the code that works fine within wordpress that I need to call: if (function_exists(‘w3tc_pgcache_flush’)) { […]

Do you have to have command line access to use Subversion with WordPress?

My group does not have command line access to the machine that is running our WordPress instance. However, we would still like to install/update using Subversion. Is this possible? Also, does Subversion need to be on the same machine?