Manipulating oembed_dataparse stopped working for YouTube embeds
I think I solved by doing this: add_filter(‘oembed_dataparse’, ‘bolster_oembed_filter’, 0, 2 ); I changed the priority of the add_filter statement to 0, now it works again.
I think I solved by doing this: add_filter(‘oembed_dataparse’, ‘bolster_oembed_filter’, 0, 2 ); I changed the priority of the add_filter statement to 0, now it works again.
It would really help to know exactly what you’re trying to achieve. The more you work with WordPress, the more the sentence “Necessity is the mother of invention” makes sense. A WordPress site is essentially snippets of html code put together with php. For example, header.php contains the instructions to build the header, the page … Read more
Registering a custom embed handler Here’s an example how we can use the wp_embed_register_handler() function in your case: /** * Register an embed handler for myvi videos */ add_action( ‘init’, function() { wp_embed_register_handler( ‘myvi’, ‘#http://www\.myvi\.ru/watch/([a-zA-Z0-9_-]+)$#i’, // <– Adjust this to your needs! ‘myvi_embed_handler’ ); } ); Here we constructed the regular expression in a way … Read more
The shortcode can be used with the src being an URL of a youtube video. To set a placeholder, preview thumbnail use poster, it even works nicely via GUI. In the end it should look somewhat like the bellow example.
I’ve just looked at the source of the WP_Embed class, and it appears they are not actually registering a shortcode, but hooking into the the_content filter. Change your code to $content_desktop = apply_filters(“the_content”, get_the_content()); or manually trigger their filter with something like $content_desktop = WP_Embed::run_shortcode(get_the_content()); or, if you prefer to have an object: $myembeds = … Read more
OK, got it. I just dug around in wp core a bit and found the function they use to grab autodetcts. WP uses the php preg_replace_callback function within the WP autoembed function. Here is the code, as seen in wp-includes/class-wp-embed.php: /** * Passes any unlinked URLs that are on their own line to {@link WP_Embed::shortcode()} … Read more
I think the solution is amazingly simple here: You’re just missing a single line of code in your ajax callback, namely: global $post; where I assume you’re using: $post = get_post( $post_id ); The reason is that there’s a global post check in the WP_Embed::shortcode() method. More details in my answer here.
You can filter the HTML output for oEmbed with oembed_result. Now test the HTTP host of the URL for www.youtube.com and add the parameter. The oEmbed result is cached in a post meta field to avoid too many requests. To update old posts I have added an activation helper that clears those cached content for … Read more
In my opinion as long as your needs are exclusively about looks it’s never a good reason to migrate to entirely different code base. The separation of backend code and frontend site is inherently one of the strengths in web development. When you you are a lone developer on own project there are roughly three … Read more
You can try the following: /** * Add support for the QuickTime (.mov) video format. */ add_filter( ‘wp_video_extensions’, function( $exts ) { $exts[] = ‘mov’; return $exts; } ); to add the Embed Media Player support for the QuickTime video files. The default supported video formats are: mp4, m4v, webm, ogv, wmv, flv Update: When … Read more