Need to embed Threads into WordPress? With a quick bit of code I’ll show you how – with both an automatic embedding method as well as a backup shortcode too.
For now, it’s pretty “quick and dirty”, but until Meta release an API this is possibly the best method.
Threads does have an embed option, which presents you with a long string of code. But, as a solution, it’s not great – you can’t just put that code into a WordPress post for a start and, unless the platform provides the code via an API, it’s something that might change regularly (fetching everything from them on demand is a better solution than hard-coding what they provided at one point in time).
Anyway, although not ideal, I’ve put together a quick piece of code that, yes, will allow you to embed Threads using their own code. So, when I said it’s not a good idea to do it like this, that’s exactly how I’m doing it. As a stop-gap. However, the code is likely to change, which is why I’m not making this a plugin and adding it to the directory – in the coming weeks/months, I suspect Meta will create more permanent solutions for this.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can either copy this code to functions.php or copy it to a blank file and save it in your plugins folder – you can then activate it as a plugin.
To use…
Head to your Thread conversation and click on the share option under it
Select “Copy link”
Now, you should just be able to paste the URL into a post and it will appear. But, if that doesn’t work, you can use the shortcode method…
In your post, add the shortcode of [threads {url}], where you replace {url} with the link that you just grabbed
If you use the shortcodes block in the block editor then you’ll type the same, but without the square brackets
Please note, with the shortcode, a preview of what it will look like will NOT show in the editor.
There are no additional parameters – if you wish to change the format then you will need to tweak Meta’s code in the function code (right now, I’m using their code as-is, without any deviation).
Talk to me!