Automattic’s WP-Now: A Game-Changer for Local WordPress Development

2 minute read

Table of Contents

June 3, 2023

Automattic, the company behind WordPress, has recently introduced a revolutionary tool called WP-Now. This NodeJS application, powered by WordPress Playground, is designed to simplify the process of setting up a local WordPress development environment. Let’s delve into the specifics of this tool and how it can be utilized.

WP-Now: A Quick Overview

WP-Now is a tool that allows developers to create a local WordPress environment in seconds. It uses automatic mode detection to provide a fast setup process, whether you’re working on a plugin or an entire site. You can easily switch between PHP and WordPress versions with just a configuration argument.

Getting Started with WP-Now

To start using WP-Now, you first need to install it. You can do this directly from npm using the following command:

npm install -g @wp-now/wp-now

 

Once installed, you can start a new server with the following commands:

cd wordpress-plugin-or-theme
wp-now start

Switching PHP and WordPress Versions

WP-Now allows you to switch between different versions of PHP and WordPress on the fly. For example, if you want to start a server with WordPress version 5.9 and PHP version 7.4, you can use the following command:

wp-now start --wp=5.9 --php=7.4

Executing a Specific PHP File

If you want to execute a specific PHP file, you can do so with the following command:

cd wordpress-plugin-or-theme
wp-now php my-file.php

Automatic Modes

WP-Now operates in a few different modes for both the start and the php commands. The selected mode depends on the directory in which it is executed. For example, if it detects a PHP file with ‘Plugin Name:’ in its contents, it operates in ‘plugin’ mode. If it detects a style.css file with ‘Theme Name:’ in its contents, it operates in ‘theme’ mode.

Future Enhancements and Known Issues

While WP-Now is a powerful tool, it’s still in development and there are some known issues and planned enhancements. For example, it currently doesn’t support custom domains or SSL, but these features are on Automattic’s roadmap. The team is also working on features like auto-detection of file modifications with automatic browser refreshing, the ability to import a database from another WordPress site, and the addition of a deploy feature for SSH/SFTP hosting.

WP-Now is a promising tool that simplifies the process of setting up a local development environment for WordPress. Its innovative use of WordPress Playground and WebAssembly technology, coupled with its ease of use and planned future enhancements, make it a must-have tool for WordPress developers.