Thanks everyone! Problem solved. I turned off all plugins, then changed the Permalinks setting to post name, saved, then back to default and saved again. Immediately after the blog was back to normal. I guess the problem is with plugins, rather than the update to 5.4 itself? Anyway, thanks!