2

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?

2 Answers 2

2

To re-save the current permalink structure with wp-cli.

  1. Get the current permalink structure first by running:

wp option get permalink_structure

Copy the results.

  1. Save the wanted permalink structure with:

wp rewrite structure '/%postname%'

Where /%postname% is the output of the first command.

0

If you wan't to refresh it, you can just use wp rewrite flush.

Source: https://developer.wordpress.org/cli/commands/rewrite/flush/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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