Title: wp_embed_register_handler
Last modified: August 21, 2016

---

# wp_embed_register_handler

 *  [OrangeDesign](https://wordpress.org/support/users/orangedesign/)
 * (@orangedesign)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/wp_embed_register_handler/)
 * Hi,
    first thx for your plugin. Now I try to use wp_embed_register_handler with
   it. wp_embed_register_handler is in my function, and it’s work with a wysiwyg
   editor (in ACF or the default one) but I use it with your plugin, and it’s does
   not work (I Generated HTML for return format). What I do it wrong ?
 * Thx for your help
 * [https://wordpress.org/plugins/advanced-custom-fields-oembed-field/](https://wordpress.org/plugins/advanced-custom-fields-oembed-field/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [edwardtownend](https://wordpress.org/support/users/edwardtownend/)
 * (@edwardtownend)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/wp_embed_register_handler/#post-4648837)
 * Hi there, please could you give some more details including your usage of the
   wp_embed_register_handler and the URL you’re trying to embed? I’ve just tested
   it with Spotify embeds using this code to register the handler [https://gist.github.com/Viper007Bond/2417309](https://gist.github.com/Viper007Bond/2417309)
   and it worked fine.
 * Kind regards
 *  Thread Starter [OrangeDesign](https://wordpress.org/support/users/orangedesign/)
 * (@orangedesign)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/wp_embed_register_handler/#post-4648849)
 * Hi, thx for your reply, my wp_embed_register_handler is :
 *     ```
       wp_embed_register_handler( 'consonet', '#http://(?:www|video)\.conso\.net/(?:video/visionneuse_conso\.php|embedvideo/)\?videoDocIdy=([\d]+)($|&)#i', 'wp_embed_handler_consonet' );
   
       function wp_embed_handler_consonet( $matches, $attr, $url, $rawattr ) {
   
         $embed = sprintf(
             '<div style="width: 644px; height: 500px; position: relative; overflow: hidden;"><iframe style="position: absolute; top: -60px; left: -5px;" src="http://www.conso.net/video/visionneuse_conso.php?videoDocIdy=%1$s" width="644px" height="415px" frameborder="0" scrolling="no" marginwidth="0" marginheight="0"></iframe></div>',
             esc_attr($matches[1])
             );
   
         return apply_filters( 'embed_consonet', $embed, $matches, $attr, $url, $rawattr );
       }
       ```
   
 * I tried to embed the conso.net videos (french site) with link like: [http://www.conso.net/video/visionneuse_conso.php?videoDocIdy=27294](http://www.conso.net/video/visionneuse_conso.php?videoDocIdy=27294).
 * As I said, with this code, it’s work on a wysiwyg field, but not with your plugin.
 *  Plugin Author [edwardtownend](https://wordpress.org/support/users/edwardtownend/)
 * (@edwardtownend)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/wp_embed_register_handler/#post-4648863)
 * Hi there, I’ve looked into this a little more and it seems that wp_oembed_get(),
   which the plugin uses to get the embed code from the URL, only supports fully
   oembed compliant providers added using wp_oembed_add_provider(), rather than 
   faking oembed via wp_embed_register_handler() as you’ve used. This doesn’t seem
   quite right to me however, I’d expect wp_oembed_get() to support either kind 
   of provider, so I’ll keep looking into it.
 *  Plugin Author [edwardtownend](https://wordpress.org/support/users/edwardtownend/)
 * (@edwardtownend)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/wp_embed_register_handler/#post-4648864)
 * A temporary fix you’d be able to implement yourself is to swap out the wp_oembed_get()
   calls for:
 *     ```
       global $wp_embed;
       $embed = $wp_embed->shortcode($args, $url);
       ```
   
 * The two places to look for are line 13 on oembed-ajax.php and line 230 of oembed-
   v4.php. I’m not going to add it to the plugin yet because it would mean losing
   the ‘object’ return type.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘wp_embed_register_handler’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/advanced-custom-fields-oembed-field.
   svg)
 * [Advanced Custom Fields: oEmbed Field](https://wordpress.org/plugins/advanced-custom-fields-oembed-field/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-custom-fields-oembed-field/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-custom-fields-oembed-field/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-custom-fields-oembed-field/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-custom-fields-oembed-field/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-custom-fields-oembed-field/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [edwardtownend](https://wordpress.org/support/users/edwardtownend/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/wp_embed_register_handler/#post-4648864)
 * Status: not resolved