[wp-trac] [WordPress Trac] #38059: 'wp_trim_excerpt' is not stripping oembed url's like shortcodes before applying 'the_content' filter

WordPress Trac noreply at wordpress.org
Wed Sep 14 19:18:24 UTC 2016


#38059: 'wp_trim_excerpt' is not stripping oembed url's like shortcodes before
applying 'the_content' filter
-----------------------------+-----------------------------
 Reporter:  wordpressdevhdn  |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Embeds           |    Version:  4.5.3
 Severity:  normal           |   Keywords:
  Focuses:  performance      |
-----------------------------+-----------------------------
 The issue is performance related. We recently realized when more than 10
 instagram urls are embedded into post directly via oEmbed urls, calling
 'wp_trim_excerpt'(directly or indirectly via get_the_excerpt()) causes
 extreme slowness. If we wrap [embed]...[/embed] shortcode around those
 urls, it does not cause any significant slowness. In context of function
 'wp_trim_excerpt', both direct embeds and embedding with shortcode should
 result in same behavior and performance. So we should find way to strip
 shortcodes as well as any oEmbed urls before applying filter
 'the_content'.
 {{{
 $text = get_the_content('');

 $text = strip_shortcodes( $text );

 /*We should strip any oEmbed urls here*/

 /** This filter is documented in wp-includes/post-template.php */
 $text = apply_filters( 'the_content', $text );
 }}}


 We're using version 4.5.3 but issue is also happening with latest
 development version.
 To reproduce the issue, enable jetpack plugin(in our case) or any other
 plugins that calls 'wp_trim_excerpt'(get_the_excerpt()), and add more than
 20 instagram oEmbeds url(but can be mix of any other oEmbed urls) to the
 post. The post should take a while(>20 secs) to load in front end.
 The problem does not occur if we don't use Jetpack plugin or trigger
 wp_trim_excerpt function.
 Expected behavior should take same time to generate as if we used
 [embed]...[/embed] which is about few seconds. Actual behavior is it takes
 too long to load post in front-end(>20 secs).
 It should happen in any environment since it's server side issue.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38059>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list