Wordpress doesn't save or publish new posts

This problem started when I wanted to create a new post. I'm using the Elementor editor, so I created a new post, set the title and featured image and then clicked on Edit with Elementor as usual. While Elementor was loading, I got this error.

My first thought was that this is an Elementor issue. But then I tried to first create a new post and then save it as a draft or publish it first before editing it with Elementor, and to my surprise, nothing happened. No matter what I do, I always end up with an auto-draft with no content which I can't change for the life of me. Can't change the name, slug, or to be precise, I can't save any changes.

The funny thing is that this happens only for posts but not for pages. I can create new pages and edit old pages and posts without problems.

Tried deactivating plugins I installed since publishing my last post, clearing the cache, using a different browser, updating everything, but nothing worked. I'm not currently using a caching plugin and I see no errors in devtools.

Any idea what could be wrong? I saw this question where they were doing something with the REST API, but I have no idea what that is, so I can't tell if I can help myself with it.

Topic publish posts Wordpress

Category Web


Finally found a solution to my problem.

In my case I had set a 301 redirect for my front page (that is for "domain.com") to another page I wanted to use as the front page. Apparently that caused a problem when Elementor tried accessing it's content (although I'm not sure why it needs the content of my front page if I'm creating a new post).

So I removed the 301 redirect and just changed which page is set as the front page in Wordpress.

To clearify: I was avoiding the front page setting because I was afraid what was going to happen to all my backlinks pointing to the page I was redirecting to. But when you change your front page in Wordpress, the page's URL becomes "domain.com" and it's previous url "domain.com/page" is automatically 301 redirected to "domain.com". Which means that all links are kept unharmed.


Edit: I finally got rid of the problem. As it turns out, my redirect was only a part of the problem concerning only Elementor. But the ability to save/publish posts in Wordpress turned out to be an internal Wordpress error. After a few weeks of dealing with this issue I finally got an error when clicking on 'Publish' inside Wordpress, saying: "The response is not a valid JSON response".

After browsing around a while I found out that I was far from being alone in this issue. It turns out it is connected to permalinks, I found that this article explains it best.

I was able to fix the issue by either changing the permalink structure to 'plain' or by installing the Classic Editor plugin. Since plain permalinks are not acceptable for me, I chose the second. I'm sure this could also be resolved in a more elegant way, but I'm not proficient enough with backend development to do it. Hopefully this will be resolved with future Wordpress updates.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.