Skip to Content

Failed to Publish Your WordPress Website? — Here’s Why

Failed to Publish Your WordPress Website? — Here’s Why

Anyone who knows the basics about how to publish a WordPress website expects that pressing the publish button will publish the content.

What happens if the publish button doesn’t work, publishing fails, or you try to update an existing post and that fails too?

As much as WordPress is simple to use, it is not so straightforward to fix things that go wrong.

Explore some hair-pulling pitfalls that break the publish button in WordPress, or cause updates to fail to appear on a live site.

Why can’t I publish my WordPress website?

The publish button breaks if the REST API connection fails. JavaScript errors also stop buttons from working. If you cannot view a published site in a browser without security warnings, your site needs the SSL certificate installed on the server for HTTPS to work.

Rest API Disabled or a plugin is breaking the connection

The WordPress Core framework uses the REST API for multiple administrator functions.

The API does two checks.

The first is to authenticate the user and the role. This is to check the user has publishing permissions granted. The second purpose is to connect to your WordPress database.

If the REST API connection is broken, WordPress can no longer authenticate the user, or connect to the database.

When that happens, the publish button stops working. Pressing publish will show you an error message stating that “Publishing Failed”. You may see a brief hint at what is possibly wrong.

“Publishing failed: Check your internet connection”. 

If it was your internet connection, your browser would not load WordPress. It is a far less intimidating message than “REST API failed to establish database connection”. That is essentially what is happening. 

As this is an API problem with WordPress core, the likely cause is a plugin attempting to either connect to the WP database, or authenticate a user, but failing.

For that reason, go to your plugins, select all and deactivate all plugins. Then go back to your post and see if you can publish it.

If you can publish new posts on a WordPress website when no plugins are active, it will be one of them that is breaking the REST API connection.

Activate the plugins individually to find the one that breaks your site.

Start with any security plugins, cache plugins, and if you run WooCommerce, all of their plugins run API requests. Reactivate those likely plugins to see if they stop your publish button from working.

JavaScript errors

The Block editor requires JavaScript to be enabled. This ties into the REST API issue because it allows for JSON (JavaScript Object Notation) files to be sent between different applications.

An easy way to tell if JavaScript is causing a problem is if nothing works.

  • A REST API error will let you press publish then show a “publishing failed” error message.
  • A JavaScript error stops all of the buttons from working.

It is worth keeping that in mind as new blocks added within the editor, are plugins. When you search for a block, if it shows on the left as “available blocks to install”, those are added to your plugins page.

If one of those newly installed blocks causes a JS conflict, the buttons will stop working as they should.

Go to your plugins page, deactivate the block plugin that was added, then go back and update, or publish.

In the block editor, JavaScript errors disable all functionality. The buttons still show, but none of them works.

Clicking the “W” logo in the top left takes you back to your dashboard. That will work because it is only a hyperlink.

Click on the posts menu item and try to load your page in edit mode. If it loads, JavaScript will be working. If JavaScript is broken, WordPress shows a prompt to alert you of the problem and gives you a link to the Classic Editor plugin.

Install the Classic Editor Plugin, then edit the post using that editor and the publish button will work again.

Otherwise, the block editor will continue having problems connecting to the database and authenticating users.

Check the URL Settings 

The URL settings are important to be able to view publicly published content in a browser.

If you have HTTP in the Site Address (URL) settings, the front-end will show an insecure website.

Go to Settings > General and make sure you have the HTTPS so that your website loads securely.

To enable SSL (Secure Sockets Layer) you need an SSL certificate.

Does that not require buying an SSL Certificate?

Depending on your web host provider, you may have a free basic level SSL certificate.

These SSL certificates are (usually) provided by Let’s Encrypt, another open-source project similar to how WordPress is open-source, meaning it is community-based and free for all.

The majority of reputable hosting companies are enrolled with Let’s Encrypt. If yours is not, you can ask them about it, or enrol for the free service.

Set a reminder to update it every three months. The maximum validity is 90 days.

The only time you may need to buy an SSL certificate is for enhanced security purposes, such as storing personal details on a dedicated server.

For a starter site on a shared hosting plan with no intention of storing people’s personal data on the server, basic level SSL is secure enough.

More importantly for bloggers intending to grow their business with organic traffic, search engines favor secure sites. You need SSL for that.

Invalid SSL certificates can prevent your site from loading

The SSL certificate should be installed on your server. Not within WordPress.

If you can work in the back end of your WordPress site (logged as admin), you should be able to publish.

When you press the preview button or the “view page” button, it should load the live page in a new tab or browser window.

Look at the URL address bar to see what is showing. If it’s anything other than a padlock, there is a problem with SSL.

When browsers fail to authenticate the SSL certificate, one of two things happen.

The address bar shows that the site is “Not Secure”. Or, it does not load the website before showing you a huge warning message making it clear that you are trying to access a site that is not secure.

When this happens, it means that you have been able to publish the WordPress website, but to view the content, you need to click the “advanced” button, then agree to proceed.

Clicking back to safety returns users to the last page visited.

To fix insecure content issues, you need to be using HTTPS in the address bar. To get that, you need the SSL certificate on your web hosts server and the general site settings set to load the HTTPS.

Use the HTTPS Redirection plugin to load all public files securely

Go to plugins, add new, search for “Easy HTTPS Redirection”. Install and activate the plugin. Go the plugin settings page, and select the option for 

“Apply HTTPS redirection on > The whole domain”. 

This will apply to all static files too. 

The manual method for this involves adding a 301 redirect to your .htaccess file. This plugin handles that so all of your static files, such as images, uploads, and your themes JS files, stylesheet, etc. will also be loaded over HTTPS.

The mixed content error happens when browsers block content that gets loaded from HTTP URLs.

Old files uploaded from before the SSL was installed such as your themes stylesheet, image library and JavaScript are usually blocked by browsers. 

Without applying 301 redirects to an entire site, the published site will show in browsers as insecure. Fix that by redirecting all of the URLs to load over a secure connection.

Staging sites need to be deployed in your web hosting account

Some hosts provide staging or development installs as a way to test updates to WordPress before making them live. Clicking “publish” on a WordPress website makes the content live on the staging site only.

These are designed for development purposes so that the live site is not affected.

To make changes on a staging site live, go to your web hosting account, select the staging site you want to publish and click the publish button there. That will migrate the staging site to the live WordPress install on your root domain.

Then you can log in and publish new content or update old content from the WP editor.