Sometimes embedding an item via oEmbed is not possible, for example when a YouTube video has embedding disabled. The oEmbed service will return a 401 Unauthorized, and the code will not be converted.

Is there a way to notify the user of this? The current workflow is non-intuitive (at least to me), and I would prefer a message on the WordPress page, or even better, in the editor, saying that the object could not be embedded.

1 Answer 1


Not possible with current code.

WP_oEmbed object goes extra mile (more like miles) to sanitize input so it is either html or boolean false. All errors with fetching are discarded on output, there are no filters in there and only error (hardcoded) it handles is 501 not implemented.

Earliest you can mess with this is somewhere down in HTTP API.

  • Maybe instead of hooking into the HTTP API, we could override the WP_Embed class, and let it use our own version of the WP_oEmbed class. We only need to override the $wp_embed global variable (and unhook the handlers set up in the constructor). But indeed, there is no easy support for this.
    – Jan Fabry
    Sep 20, 2010 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.