Skip to content

Instantly share code, notes, and snippets.

@WerdsWords
Created August 5, 2013 23:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save WerdsWords/6160581 to your computer and use it in GitHub Desktop.
Save WerdsWords/6160581 to your computer and use it in GitHub Desktop.
#34: $type_send_to_editor_url
<?php
/**
* Add data-type attribute to video links sent to the editor
*
* @param string $html The link HTML sent to the editor.
* @param string $src The media item source URL.
* @param string $title The media item title.
*
* @return string The link embed HTML markup.
*/
function wpdocs_video_link_data_type( $html, $src, $title ) {
// Since the 'type' is defined in the filter hook, we know the type is video
return '<a href="' . esc_url( $src ) . '" data-type="video">' . $title . '</a>';
}
add_filter( 'video_send_to_editor_url', 'wpdocs_video_link_data_type', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment