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 | |
function wp_embed_handler_image( $matches, $attr, $url, $rawattr ) { | |
$embed = sprintf( | |
'<img src="%1$s" alt="" />', | |
esc_attr($matches[0]) | |
); | |
return apply_filters( 'embed_image', $embed, $matches, $attr, $url, $rawattr ); | |
} | |
wp_embed_register_handler( 'image', '/^https?(:\/\/[-_\.!~*\'()a-zA-Z0-9;\/:\@=+\$,%#]+)(\.jpe?g|\.gif|\.png)$/', 'wp_embed_handler_image', 10, 4 ); |
スケルトンだから、色々機能を追加してください。あと、WordPress で oEmbed 有効にしておいてね
コメントを残す