I noticed the problem when one of my posts wasn’t displaying the tweet I embedded in the post.
Instead, the post was showing the tweet URL.
Hmmm, I wondered.
What happened? Did I add an extra character to the URL?
Troubleshooting the Missing Tweet
To check, I copied the tweet URL and entered it into my browser.
I frowned when the browser displayed the “page not found” message.
Huh? The tweet no longer existed.
Argh.
I mentioned the problem on Twitter to my colleague Adrian Roselli:
@aardrian I embed lots of tweets in posts. When someone closes account or deletes tweets, the post displays a non-working link.
— DeborahEdwards-Onoro (@redcrew) January 27, 2017
Adrian asked me how I was adding the tweet to the blog post.
I replied that I copied the tweet URL into its own line in WordPress, which makes it easy to add tweets.
And that’s the problem, as Adrian pointed out.
When the tweet is deleted, nothing will display, other than the non-clickable URL.
How to Ensure a Tweet Displays in Your Post, Even When the Tweet is Deleted
Adrian explained how he uses the native Twitter Embed Tweet option (available from the contextual menu) to copy the code to add to his blog post.
@redcrew …and of late go into the embedded HTML tweet and expand all URLs so when the tweet gets deleted I still have it all.
— Adrian Roselli 🗯 (@aardrian) January 27, 2017
With the embed code, when a tweet is deleted, the text content of the tweet will still display.
It will look a bit different, without all the fancy Twitter styling.
I tried the embed code, and yes it worked flawlessly.
When you use the embed code, you have customization options for the embed:
- Light or dark theme
- Hiding conversations
- Opt-out of tailoring Twitter
Summary
If you’ve used a shortcode or added the tweet URL to embed a tweet in your post, a non-working URL will display when the tweet is deleted or the Twitter account is closed.
Which is what happened with my post. WordPress made it easy for me to simply add the tweet URL.
I learned my lesson on how to get embedded tweets display.
Take the extra step to use the Twitter native embed tweet code in your blog posts.
Thank you for your help, Adrian!