Here is how to get or set WordPress permalinks using WP-CLI

[code]
wp option get permalink_structure
[/code]

[code]
wp option update permalink_structure '/%postname%'
[/code]

Success: Updated 'permalink_structure' option.

The following command was supposed to set the proper permalink structure, however, I noticed that it also prepends index.php to the supplied stucture. Let's see if it's a bug or a feature https://github.com/wp-cli/wp-cli/issues/2184

[code]
wp rewrite structure '/%postname%'
[/code]

 

 

Disclaimer: The content in this post is for educational purposes only. Always remember to take a backup before doing any of the suggested steps just to be on the safe side.
Referral Note: When you purchase through an referral link (if any) on our site, we earn a commission.