WordPress automatically converts a YouTube URL in the content of a page/post to a embedded iframe video.
It respects the start
parameter, if present, in the YouTube URL, but it does not respect the end
parameter, if present.
I therefore need to locate the WordPress code that handles this automatic YouTube embed functionality so I can, hopefully, hook in my own filter that (using this solution) will take care of the end
requirements.
I have searched through the class-wp-embed.php
, class-oembed.php
and media.php
files of the /wp-includes/
directory and, in the latter, thought I had found the code I needed…
apply_filters( 'wp_embed_handler_youtube', $embed, $attr, $url, $rawattr )
…but that filter doesn’t seem to get called.
Can anyone point me in the right direction?
I had same problems and not found answer. So here is working solution:
You can customize the youtube url and set various condition.I have implemented it in past.You may get some reference from the below code: