After moving a site to a new domain, or from http to https, old addresses remain stored in the database and need replacing.
Option 1: Better Search Replace plugin
- Back up your database.
- Install and activate Better Search Replace.
- Go to Tools › Better Search Replace.
- Enter the old URL (e.g.
https://old-domain.co.uk) and the new one (https://new-domain.co.uk). - Select all tables and tick Run as dry run. Check the number of changes it reports.
- Untick dry run and run it again.
Option 2: WP-CLI over SSH
wp search-replace 'https://old-domain.co.uk' 'https://new-domain.co.uk' --all-tables --dry-run
Remove --dry-run to make the changes.
Don't edit URLs directly in the database with a plain SQL find-and-replace, as this breaks serialised data used by many plugins and themes.
Afterwards, clear any caches and re-save Settings › Permalinks.