<?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 有効にしておいてね