Extract the first oembed url inserted on the content of a post

I assume that you’re only interested in the first URL that actually succeeds at discovering actual oembed data. The oembed system processes all links it finds, but not every link will have oembed going for it, obviously. The filter you’ll want to use is embed_oembed_html and it gets the HTML cached by oembed, the url, … Read more

Changing Oembed max width based type of page

Using the following in your functions.php file should do the trick: /** * Configure default oEmbed video sizes */ function base_oembed_defaults($embed_size) { if( is_single() ) { $embed_size[‘width’] = 580; $embed_size[‘height’] = 435; } return $embed_size; } add_filter(’embed_defaults’, ‘base_oembed_defaults’); Add as many WordPress conditional statements as you like to match the desired aspect ratio for each … Read more

Fallback for oEmbed content

Probably impractical. When you do not control the content you can not know if it will be embedable at the time of viewing. Easiest example of why it might be hard in the context of youtube/vimeo is videos that can become restricted, either private or geo restricted. In that case the content is still embedable … Read more

Heartbeat API oEmbed

The problem: The reason why this isn’t working, is this part of the WP_Embed::shortcode() method: if( $post_ID ) { …. cut … // Use oEmbed to get the HTML $html = wp_oembed_get( $url, $attr ); … cut … } When trying to autoembed with the Heartbeat API the $post_ID is null, so wp_oembed_get() is never … Read more

Markup of oEmbed codes in the editor?

I think this might be a step in the right direction: http://codex.wordpress.org/Plugin_API/Filter_Reference Specifically the the_editor_content filter which is “applied to post content before putting it into a rich editor window.” Sorry I can’t flesh it out more for you but I am just starting to play around with filters myself and have miles to go … Read more

YouTube oEmbed and privacy-enhanced mode

At the moment WordPress only recognises youtube.com/watch, youtube.com/playlist and youtu.be. However there is wp_oembed_add_provider; try something like wp_oembed_add_provider( ‘#http://(www\.)?youtube-nocookie\.com/embed.*#i’, ‘http://www.youtube-nocookie.com/oembed’, true ); (untested sorry). You could even overwrite the existing providers to redirect to -nocookie and then use the video shortcode as normal. And you can do this with add_filter(‘oembed_providers’, … ); too if you’d … Read more

Correct regex for wp_embed_register_handler

Just few notes here: We have to be careful using % within sprintf() to avoid confusion with the placeholders. Try to remove the CSS styles. It’s sometimes easier to use the # or ~ delimiters in regular expressions, instead of the / delimiter. Since you have the (players.brightcove.net/) as the first match, it might not … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)