WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#42482 closed defect (bug) (invalid)

Bizarre oEmbed Behaviour

Reported by: andyphillips82 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.8.2
Component: Embeds Keywords:
Focuses: Cc:

Description

Hi all,

Banging my head against something, hoping you guys can help.

We upgraded from 4.7.2 to 4.8.2, and immediately saw an uptick in update_post_meta calls. Took us a while to track it down, but we narrowed it to oEmbeds. This is a weird one.

Multiple posts have no oEmbeds but when I query them in the DB, they have 20-80 oEmbeds associated to the post_id in the postmeta table. Other posts' oEmbeds are somehow being associated with these posts on mass.

Well there's our uptick in update_post_meta calls!

I've been looking at class-wp-embed.php:143 shortcode() and I can't for the life of me figure out why this is happening. I've also looked at all the diff of the relevant files from 4.7.2 to 4.8.2. I'm clearly missing something.

I haven't been able to isolate when or why it does the update_post_meta to the wrong post_id.

Anyone have any thoughts?

Change History (3)

#1 @swissspidy
3 years ago

Hey there,

Multiple posts have no oEmbeds but when I query them in the DB, they have 20-80 oEmbeds associated to the post_id in the postmeta table. Other posts' oEmbeds are somehow being associated with these posts on mass.

That sounds like you're using embeds in widgets or somewhere else outside the loop.

Up until 4.9, oEmbeds always need a post ID to be associated with. It could be that on your site you have manually embedded posts outside the loop, e.g. in the sidebar and then the oEmbeds get saved for the current $GLOBALS['post'].

Starting with 4.9, these embeds will get stored as custom posts instead.

#2 @andyphillips82
3 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Yes! Sorry, we figured this out a few days ago and I should have updated the ticket.

You are exactly correct, this was precisely what was happening. Cheers!

The only bizarre thing was that it only started showing symptom from 4.7.5 to 4.8.2. So maybe we hit a critical mass in post_meta? I dunno.

#3 @swissspidy
3 years ago

  • Milestone Awaiting Review deleted

Great to hear you could resolve it.

Note: See TracTickets for help on using tickets.