The problem was that I had set localhost earlier, then I changed it to my hostname, but the guid
field in the wp_posts
table remained unchanged. I solved the problem this way:
UPDATE wp_posts SET guid = REPLACE(guid, 'https://localhost', 'https://hostname');
Thanks so much to vadubai for responding very quickly to my request and trying to help me.