I moved many WordPress sites to a new server and all permalinks need to be "refreshed". I need to save again (without any changes) settings->permalinks to resolve pages/posts 404 error.

I ask if it exists a way to save permalinks (without changes) from wp-cli.

I Know:

wp rewrite structure

but the structure of the permalinks must be passed as a parameter and each site has a different one and I need only to save with the same settings.

It's possible?


You can try to get current structure first by run

wp option get permalink_structure

and then

wp option update permalink_structure '/%postname%'


wp rewrite structure '/%postname%'

with '/%postname%' is the return result of the first command.

Not sure if this help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.