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 a referral link (if any) on this page, we may earn a commission.
If you're feeling thankful, you can buy me a coffee or a beer
This seems to work without the quotes:
`wp rewrite structure /%postname%/`
I had additional issue because I was running this in a batch file, and the % needs to be escaped, so if you are running this in a (windows) batch file it should be:
wp rewrite structure /%%postname%%/
Thanks