Skip to content

Instantly share code, notes, and snippets.

@PauliusKrutkis
Last active March 7, 2017 20:51
Show Gist options
  • Save PauliusKrutkis/5589d1af63e34b28e200bd39897d2ce2 to your computer and use it in GitHub Desktop.
Save PauliusKrutkis/5589d1af63e34b28e200bd39897d2ce2 to your computer and use it in GitHub Desktop.
Wordpress - change content attachment html
<?php
function editMediaTemplate($html)
{
$class = 'attachment-link';
return str_ireplace('<a href', sprintf('<a class="%s" href', $class), $html);
}
add_filter('media_send_to_editor', 'editMediaTemplate', 20, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment