I try to add articles via wp_insert_post but as it seems the oEmbed function of Wordpress doesn't work properly.

I work with embedly as you can embed any website.

I realized that the oEmbed functionallity is triggered after saving the post in the Wordpress-Backend.

Can i trigger the Embed somehow programmaticly?

Wrap the URL with the Shortcode [embed] is not working.

2 Answers 2


Read up on Embeds.

To trigger an embed use wp_oembed_get($url).

In general the url needs to be on it's own line with a space below and above when inside the_content. wp_insert_post() has nothing to do with embeds as the embed HTML is usually generated when passed through the_content filter.

To add support for non-oEmbed sites use wp_embed_register_handler()

And for oEmbed-enabled sites use wp_oembed_add_provider().


I was just thinking about your support ticket when I found this question, thanks for letting us know about this. I work at Embedly and am the primary author of the embedly plugin.

I'm pretty sure @jgraup is correct that you need to utilize the wp_oembed_get function (this is called automatically when editing in the tinyMCE post editor). If you're using the embedly plugin we will already be registered as the default oEmbed provider. I will try to test myself asap.


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.