There can be many reasons why this can happen. In my case I couldn’t locate the change that was made in WordPress that caused the issue. The only major change since the last time a post was added was a WordPress update, but that didn’t strike me as being the reason as it wasn’t a major version.
Be that as it may, what solved the issue for me was this link – to summarize, change the following lines in wp-config.php
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/'); define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');
to
define('WP_SITEURL', 'http://DOMAIN/'); define('WP_HOME', 'http://DOMAIN/');
of course, replace DOMAIN with the primary domain for your WordPress app.
an alternative method is here, though I haven’t tried it