How to change the homepage in WordPress via CLI.
e.g I have one page called "Home1" and I want to make that page the homepage. In other words, I want to change the "Static Page" via CLI.
How to change the homepage in WordPress via CLI.
e.g I have one page called "Home1" and I want to make that page the homepage. In other words, I want to change the "Static Page" via CLI.
#Listing all pages
wp post list
#Listing all pages with type page
wp post list --post_type='page'
#Updates an option value for example the value of Simple page is id = 2
wp option update page_on_front 2
#Update the page as front page by default.
wp option update show_on_front page
You can use the wp options update command, see the documentation
wp option update show_on_front 'page' --path="WORDPRESS_PATH"
wp option update page_on_front pageId --path="WORDPRESS_PATH"
first of install the WP-CLI in your system. here,is the reference for how to install the wp-cli
https://www.sitepoint.com/wp-cli/
https://make.wordpress.org/cli/handbook/installing/
after succesfully install wpcli use wp option command
syntax :- wp option update page_on_front {$page_id} --allow-root
example :- wp option update page_on_front "14" --allow-root