Automate Homepage and Blog Page Setup in WordPress with WP-CLI

Would you like to automate the setup of your homepage and blog page in WordPress using WP-CLI? You can easily achieve this with the following commands:

wp option update page_on_front 116 # <- 116 is the id of the homer page.
wp option update page_for_posts 114 # <- 114 is the id of the blog page.
wp option update show_on_front page 

This solution has been tested in WordPress v6.7.1 and WP-CLI 2.10.0. After running these commands, your settings page will reflect the following changes:

Screenshot of WordPress Reading Settings showing "Your homepage displays" with "A static page" option selected, and dropdown menus for "Homepage" and "Posts page."
WordPress Reading Settings screen displaying the option to set a static page as the homepage.