Reading Time: 3 minutes
Is WP-CLI on your radar?
If WP-CLI, or WordPress Command Line Interface, isn’t on your radar, it should be. In technical terms, WP-CLI makes WordPress features and functions, such as site and user administration, available via the command line. Utilizing WP-CLI allows your developer to issue commands directly to WordPress. In turn, those commands allow site maintenance, including core and plugin updates, batch processing of images and video and broad transformations to databases, all without the overhead of a web page. WP-CLI is extremely useful in instances when site redesign includes an updated sitemap, for example, editing the structure of your navigation menu or changing the naming convention of your site’s taxonomies. For a common example, a page on your site that was previously called “Contact Us,” is now being labeled “Get in Touch” and you want to change all link text across hundreds of thousands of articles to reflect this new name. Accomplishing something like this, without WP-CLI, would mean going through every article and manually changing “Contact Us” to “Get in Touch.” Implementing the same change with WP-CLI allows you to edit those associations in one fell swoop, meaning more time to devote to functionality, mobile design, user interface, etc., and more importantly, saved hours reduces your project’s expense.
Here’s how we would write a command like this:
$ wp search-replace 'Contact Us' 'Get in Touch' wp_posts --dry-run
Using WP-CLI before launch
Most WordPress sites begin by setting up the structure and organization of your content. This includes custom post types, sidebars, menus, and taxonomy. While going through this process, developers will create “test” content to populate the site and review the content structure and relationships. Without WP-CLI, to remove all the “test” content, developers would have to manually do so. Even if your developer is top-notch, there is always the possibility for human error when eliminating test instances manually. However, utilizing WP-CLI eliminates the chance of launching your site live, with unintended test content. WP-CLI makes it easy to bootstrap the site in this way, allowing developers to create, recreate and remove (useful prior to deployment) this content by running one single command.
Further, WP-CLI is paramount before your site’s launch, and there are a myriad of situations where a developer would use this. One example would be on larger sites with custom server architecture. Using WP-CLI, developers are able to manage caching, cron, and other security and performance features leading up to, and after, launch. Command Line Interface is also useful for site migrations, maintenance of plugins and WordPress core, user administration, and more.
How WDG has used WP-CLI
And this may all sound simple, put in one command, and BAM! It’s all taken care of, but it is in reality, a very complex system, and far too few developers attempt the undertaking. At The Web Development Group, we have utilized WP-CLI since shortly after its inception, and integrate this for nearly all of our clients. On one of our recently-launched projects, a website redesign project for SpaceNews, we built WP-CLI scripts to migrate content from Drupal to WordPress, and transform that content to a new organizational structure. The content involved ten years of archived material from a variety of sources, and WP-CLI was utilized to guarantee that information was merged successfully without overlapping or inaccurate data, and to ensure that authors, media, and links were handled appropriately, preventing any loss in the integrity of article content. Once it was migrated, we were able to map matching terms from their previous taxonomy structure over to a new structure developed by our strategy team, to better serve the SpaceNews audience.
Searching for a Developer?
If you are searching for a web design and development agency, make sure to ask about using WordPress Command Line Interfaces, and test developers on their ability to better provide a seamless project with a faster turnaround time, all while saving you funds.