Tag Archives: Wordpress

Embedding Mastodon posts in WordPress

I’m someone who has made their escape from Twitter, mostly posting to a mix of Mastodon, Threads and Bluesky.

It was really easy to embed a Twitter post in WordPress: just paste the URL into the block editor and it’d do the hard work for you.

That doesn’t work for Mastodon, possibly because it’s so many different domains (servers) that WP can’t figure out when it’s a Mastodon post. Pasting the URL just displays… the URL.

Mastodon does have a function to get the embed code, which you can put into a WP Custom HTML block… but that didn’t work for me either. On my personal blog with its modified Twenty Twenty theme, the Mastodon post appeared hard against the left hand side of the browser window, out of whack with the rest of the post text.

With some experimentation and Googling, I discovered that tweaking the embed code slightly made it better.

Basically in the HTML, edit the blockquote style attribute margin and change it from 0 to auto. That made it appear in line with the rest of the post.

I’d love to show you it here, but it turns out the even older theme we’re using on geekrant.org.right now can’t handle them at all. Attempting to save a post with embedded Mastodon HTML results in a Save error. (And I don’t have time right now to get screen grabs.)

Hmm, might be time for a theme update.

Anyway, hope this helps someone else out there (and remind me of what I need to do next time).

WordPress issues and Cloudflare

Cloudflare will speed up one web site for free. I’ve used it a fair bit over the years for my main blog, and it seems to have been pretty good.

Recently I struck some issues:

  • I could not save a post with the word “Casin0” in it. (actually spelt with an “o”; I was referencing the town in NSW.)
  • Sporadic “Updating failed. you are probably offline” errors from WordPress when trying to save (existing) posts
  • Sporadic image upload failures

On the first I temporarily gave up and spelt it with a zero. This is still unresolved, and it affects this blog too. It’s probably a web host issue – a security filter somewhere.

But while researching the second issue, I saw a reference to Cloudflare, and tried turning it off. It resolved it immediately. I suspect it was the cause of the third problem too.

Now I’ll need to more thoroughly investigate WordPress caching. The W3 Total Cache free plugin seems to do an okay job.

UPDATE: And then the error started coming back, but only for saving new posts – not editing existing ones. It seems I need to keep investigating.

One problem I’ve had is WP Multi-site seems a bit dodgy, at least with my setup. There are instructions for turning it off here.

Still worth trying turning off Cloudflare if you’re having issues though.

WordPress’s autosave freezes up

I’m glad it’s not just me: WordPress’s Gutenberg editor is very nice, but it has an autosave feature which gets stuck regularly.

Very annoying. If you browse away, you lose changes. You can’t do a conventional Save Draft while the autosave is stuck.

It’s not constant, so I’m not really sure how to fix it. But there are a couple of workarounds.

1. Noted on this thread: add this to wp.config:

define(‘AUTOSAVE_INTERVAL’, 86400);

(that’s a full day, so it should rarely be a problem then)

2. This method seems to work for me:

  • Press Ctrl-A twice, to highlight the entire post text
  • Ctrl-C to copy it to the clipboard
  • Paste it into a text editor. You’ll see the WordPress markup, which shows <!– wp:paragraph –> at the start of each paragraph.
  • Jump out of the draft. Ignore the warning about losing your work
  • Go back into it. If it’s like what happens with mine, anything since the previously successful draft save will have been lost
  • Ctrl-A twice to highlight the entire post text, then Delete it all
  • Then Paste from your copy in the text editor. The entire post should be back, including references to articles

Okay that’s a lot of steps, but for an occasional problem, seems like a reasonable workaround, especially if fiddling with the wp.config isn’t your thing.