Assets are using old domain name after migrating

Image URLs in the post content aren’t affected by the “WordPress Address” and “Site Address” settings. They’re part of the text of the post, rather than something that’s generated using those settings. If you’ve moved to a new domain, you’ll need to change these URLs.

If you’re comfortable using the command line, I recommend installing wp-cli (if you haven’t already) and then using its powerful search-replace command. I always do a dry run of any search-replace command first, to make sure I’ll see the results I expect.

wp search-replace --dry-run https://old-domain.com/ https://new-domain.com/ --report-changed-only

…and then, if I’m satisfied it’s going to replace the strings I need it to replace (and, crucially, only the strings I need replaced)…

wp search-replace https://old-domain.com/ https://new-domain.com/ --report-changed-only

error code: 521