Skip to content

Instantly share code, notes, and snippets.

@wokamoto
Created December 13, 2012 05:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wokamoto/4274277 to your computer and use it in GitHub Desktop.
Save wokamoto/4274277 to your computer and use it in GitHub Desktop.
@kai4den
<?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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment