Created
August 5, 2013 23:27
-
-
Save WerdsWords/6160581 to your computer and use it in GitHub Desktop.
#34: $type_send_to_editor_url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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