Opened 8 weeks ago
Last modified 8 weeks ago
#64941 new enhancement
Support TikTok carousel embeds
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Embeds | Keywords: | has-patch |
| Focuses: | Cc: |
Description
TikTok has image-based carousel embeds now. The URL looks like
https://www.tiktok.com/@itsklarissat/photo/7614533377500138782
When trying to embed this URL it will throw an error

If you replace "photo" with "video" in the URL like:
https://www.tiktok.com/@itsklarissat/video/7614533377500138782
It looks like the oembed regex is:
'#https?://(www\.)?tiktok\.com/.*/video/.*#i' => array( 'https://www.tiktok.com/oembed', true ),
A second regex to match the photo URL could be added or it could be updated like
'#https?://(www\.)?tiktok\.com/.*/(?:video|photo)/.*#i' => array( 'https://www.tiktok.com/oembed', true ),
An alternate solution might be a more generic match, which could account for other URL formats they may add in the future.
'#https?://(www\.)?tiktok\.com/.*/[^/]+/.*#i' => array( 'https://www.tiktok.com/oembed', true ),
I tested this with WordPress 6.9.4 on Twenty TwentyFive and no plugins.
Change History (5)
This ticket was mentioned in PR #11345 on WordPress/wordpress-develop by NicktheGeek.
8 weeks ago
#1
- Keywords has-patch added
#2
@
8 weeks ago
I added a potential PR that makes for a more generic URL match, so if TikTok adds other keyword options in the URL, it will still match those without requiring future code changes.
#3
@
8 weeks ago
- Summary changed from TikTok carousel embeds do not work to Support TikTok carousel embeds
- Type changed from defect (bug) to enhancement
#4
@
8 weeks ago
It does look like TikTok might not support requests to the /photo/ URL via the oembed endpoint just yet. I have added a filter to register the endpoint and then modify the provider request URL to swap photo with video in a plugin for now.
#5
@
8 weeks ago
'#https?://(www\.)?tiktok\.com/@.*#i' => array( 'https://www.tiktok.com/oembed', true ),
src/wp-includes/class-wp-oembed.php Line 106
Privider URL is handled here for https://www.tiktok.com/@itsklarissat/photo/7614533377500138782. It seems tiktok doesn't just support /photo for oembed like https://www.tiktok.com/oembed?maxwidth=600&maxheight=750&url=https%3A%2F%2Fwww.tiktok.com%2F%40itsklarissat%2Fphoto%2F7614533377500138782&dnt=1
An alternative could be modify the embed url via using embed_defaults filter.

Currently, the oembed uses
videoin the URL, so it does not matchphoto. This makes it more generic to matchvideo,photo, and other potential future keywords in the URL.Trac ticket: https://core.trac.wordpress.org/ticket/64941#ticket
## Use of AI Tools
No AI was used to make this code change.