这是一个令人发指的黑客行为,它将上传图像的标题替换为url(通过从指甲上剪下“-150x150”词缀构建):
function wpse156087_admin_footer_media_new_php() {
?>
<script type="text/javascript">
jQuery(document).ready(function() {
(function ($) {
uploader.bind(\'UploadComplete\', function() {
setTimeout(function() {
$(\'#media-items .media-item\').each(function () {
var img_src = $(\'img\', this).prop(\'src\');
if (img_src.indexOf(\'/wp-content/uploads/\') > 0) {
$(\'.filename.new .title\', this).html(img_src.replace(/-150x150(\\.[^.]+)$/, \'$1\'));
}
});
}, 100);
});
})(jQuery);
});
</script>
<?php
}
add_action( \'admin_footer-media-new.php\', \'wpse156087_admin_footer_media_new_php\' );