WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#34674 closed defect (bug) (invalid)

Failure updating excerpts when a plugin is using get_the_excerpt() function

Reported by: dartiss Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description

Apologies if this isn't an actual bug but I can't see any reference to this anywhere and not sure what else to look at.

I've authored the plugin YouTube Embed. With version 4.0 I used get_the_excerpt() to get information for video metadata. However, upon release I heard from a number of users who were finding it was causing other plugins to crash - e.g. Jetpack Social and Add to Any.

I found that by simply removing the above function call it would rectify the issue. However, I'm unable to understand why.

The plugins with issues all have one thing in common - they're modifying the excerpt. So why would a read of the excerpt data then cause these to crash in some way? I tested specifically with Add to Any and no errors were output but, equally, it would not output the share icons for any post that called the get_the_excerpt function. However, it would work on any other post that didn't call my plugin.

So, I'm left with a dilemma as I don't believe my plugin is doing anything illegal and is simply calling, within a post, a valid WordPress function. So why would it then have such an effect on other plugins?

Any thoughts/suggestions on this would be greatly appreciated.

Change History (3)

#1 @swissspidy
6 years ago

Can you elaborate a bit more on what you are doing with get_the_excerpt(), maybe with some example code?

I know many plugins filter the post excerpts (in good and bad ways), so if you want the raw data, you could always access $post->post_excerpt directly.

#2 @dartiss
6 years ago

Hi. My code was literally $excerpt = get_the_excerpt(); so nothing special. This was on a line on its own and simply removing this was enough to get the other plugins to start working again.

I know I can work around it like this but was wondering why a call to a WordPress function such as this should cause such a catastrophic failure elsewhere. If their plugin runs first they're adding to the excerpt and I'm simply reading it. Shouldn't cause a problem. If mine runs first I'll have changed the shortcode to video embed code. But why would that then cause adding to the excerpt in these other plugins to fail?

I'd obviously blame sloppy coding by them (ahem) but it's multiple plugins, including Jetpack, so that appears unlikely (and hence why I've logged this as a potential core issue).

#3 @obenland
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

This doesn't seem to be a core-related problem. Discussion can continue with the ticket closed.

Note: See TracTickets for help on using tickets.