[wp-trac] [WordPress Trac] #30660: Embed handler filter callback not firing (e.g. wp_embed_handler_youtube)

WordPress Trac noreply at wordpress.org
Wed Dec 10 15:52:31 UTC 2014


#30660: Embed handler filter callback not firing (e.g. wp_embed_handler_youtube)
--------------------------------+-----------------------------
 Reporter:  eterps              |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Embeds              |    Version:  4.0.1
 Severity:  normal              |   Keywords:
  Focuses:  ui, administration  |
--------------------------------+-----------------------------
 I'm trying to create a filter for the new auto-embed feature in Wordpress
 4.0 and edit the default output for the embed tag with a filter function.

 I have a snippet set up like this in my theme's function.php:

 {{{
 add_filter( 'wp_embed_handler_youtube', 'bigger_youtube_embeds', 10, 4);
 function bigger_youtube_embeds($embed, $attr, $url, $rawattr) {
     // alter the $embed string...
     return $embed;
 }
 }}}

 I tried this after viewing the following documentation:
 https://developer.wordpress.org/reference/hooks/wp_embed_handler_youtube/

 My filter function never runs, though, and I'm not even sure when it is
 supposed to run.  I've tried setting Xdebug breakpoints inside the filter
 function, and using var_dump, and returning a gibberish string ('hello
 world') from the callback, but nothing ever happens.

 Steps to reproduce:
 1. add a filter or action (I've tried both) for wp_embed_handler_youtube
 and define a callback.
 2. Create a new post and paste in a YouTube URL.
 3. The auto-embed code will run and create an embedded video.
 4. Save the post
 5. View the post

 At no point in this process did my filter callback ever get called.

 My Env:
 - Ubuntu 12.04
 - PHP 5.4.34
 - Wordpress 4.0.1
 - Client: Mac OS X + Chrome 39 / Firefox 34

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


More information about the wp-trac mailing list