[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
Tue Apr 9 21:03:23 UTC 2019


#38059: 'wp_trim_excerpt' is not stripping oembed url's like shortcodes before
applying 'the_content' filter
-----------------------------+--------------------------
 Reporter:  wordpressdevhdn  |       Owner:  (none)
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  Formatting       |     Version:  2.9
 Severity:  normal           |  Resolution:  invalid
 Keywords:                   |     Focuses:  performance
-----------------------------+--------------------------
Changes (by desrosj):

 * status:  new => closed
 * version:  4.5.3 => 2.9
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 Hey @wordpressdevhdn!

 Welcome to Trac! First, I'm sorry that it took so long for someone to
 respond to this.

 The only way that I am able to reproduce the issue you have described is
 to open the database and remove all `_oembed_time_*key*` and
 `_oembed_*key*` meta entries for the post (or have a plugin or theme that
 does something similar). Also, the issue will only happen for excerpts
 when using the Classic Editor, or the Classic Editor block in the new
 block editor.

 The new block editor does not have this problem by default. The new
 `excerpt_remove_blocks()` function will remove all embed blocks before the
 excerpt is scanned for oEmbed URLs. The issue can be reintroduced if a
 plugin uses the `excerpt_allowed_blocks` filter to add an embed block, and
 there is code on the site removing oEmbed cahces, as described above. For
 example:

 {{{
 function myplugin_add_instagram_to_excerpt( $blocks ) {
         $blocks[] = 'core-embed/instagram';

         return $blocks;
 }
 add_filter( 'excerpt_allowed_blocks', 'myplugin_add_instagram_to_excerpt'
 );
 }}}

 Another thing to note is that oEmbeds are cached as they are loaded for
 the first time in both the front end and admin. So as they are added to
 the editor, they are also cached. So even when the post is viewed on the
 front end for the first time, displaying the embed should not require any
 external API calls.

 I did look at the current version of Jetpack, and it does not appear that
 they are deleting oEmbed caches at all.

 For these reasons, I am going to close this out. If you are still able to
 reproduce this with a fresh install, please add some more details so it
 can be investigated further.

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


More information about the wp-trac mailing list