More fixes

"Publishing failed. You are probably offline." in WordPress

You press Publish or Update in the block editor and a red bar says "Publishing failed. You are probably offline." (or "Updating failed"). Your internet is usually fine. The editor saves by sending the post to your own site in the background, and that request came back with no answer it could read: something blocked it, cut it off, or sent it to the wrong address. Your text is still in the open tab, so do not close it yet.

What the owner sees

harborbakery.example/wp-admin/post.php?post=412&action=edit

What the checks found


  

First, keep your work

Before anything else, select all the text in the post (click in it, Ctrl+A twice, Ctrl+C) and paste it somewhere safe. The editor also keeps a local backup in the browser and offers "The backup of this post in your browser is different" next time, but a copy you made yourself is certain.

Find out which case it is (five minutes)

  1. Open the browser's developer tools on the editor (F12, or right-click, Inspect), choose the Network tab, and press Update again. Find the red request to /wp-json/wp/v2/posts/ (or ?rest_route=). Its status is the answer:
    • (failed), (blocked) or net::ERR_: the browser never got a reply. Go to step 2.
    • 403: a firewall or security plugin refused it. Go to step 3.
    • 500, 502, 503, 504 or a long wait then failure: the server broke or ran out of time. Go to step 4.
  2. Try a private window with no extensions, or another browser. If it saves there, an ad blocker or privacy extension is blocking the request. If the request's address starts with http:// while the editor is on https://, the site's own address settings are wrong (Settings, General) and the browser blocks the mixed request.
  3. Does it fail only on some posts? Server firewalls (ModSecurity on many shared hosts, or a security plugin) block saves whose text looks like code: a pasted script, an iframe, words like SELECT ... FROM. Save a short test post. If that works, remove the last pasted block and try again. The firewall log or the host can name the rule.
  4. Is it a long post, or is the whole admin slow? A save that takes longer than the host's time limit is cut off and looks like "offline". Tools, Site Health shows REST API and loopback problems; the server's error log shows a PHP fatal error if a plugin crashes during the save.
  5. Behind Cloudflare or another proxy? A "bot fight" or WAF rule can challenge the editor's background request. Its Security Events log will show the blocked /wp-json/ request.

The fixes, by case

  1. An extension: allow your own site in the ad blocker or privacy extension, or turn it off on /wp-admin/.
  2. Wrong site address: in Settings, General, make both addresses the https:// one you actually use (if they are greyed out, they are set in wp-config.php; change them there).
  3. A firewall rule: allow the rule for /wp-json/wp/v2/ requests from logged-in editors in the security plugin, or ask the host to whitelist that one ModSecurity rule ID for your site. Paste embed code through a proper embed block instead of raw HTML where you can.
  4. A plugin that turns off the REST API: some "disable REST API" or hardening settings also lock out the editor. Allow it for logged-in users, or switch the plugin's setting off.
  5. A crash or time-out: the error log names the plugin; update or replace it. If the server is just slow, ask the host to raise the time limit or fix the slow plugin first.
  6. A proxy rule: skip the challenge for /wp-admin/* and /wp-json/* when the request carries your login cookie.
  7. Test: reload the editor, make a small change, Update, and open the post in a new tab to see the change is really saved.

What you see, what it means, what it needs

What you seeWhat it meansUsual fix
Saves in a private window, fails in your normal oneAn extension blocks the save requestAllow your site in the extension
Network tab shows a 403 on /wp-json/A firewall or security plugin refused itAllow the rule for the editor, or ask the host
Only posts with pasted code or embeds failA firewall pattern matches the textUse an embed block, or whitelist the rule
Request goes to http:// from an https:// editorSite address is set to the old http oneFix both addresses in Settings, General
500/504, or long wait then failureA plugin crashes or the save times outRead the error log, fix the plugin, raise the limit

What not to do

Most of these are one extension setting, one address or one firewall rule. If every save fails and you cannot find what is blocking it, that is what the box below is for. Related: "The response is not a valid JSON response", cURL error 28 and REST API errors in Site Health and "Are you sure you want to do this?".