包括这个小插件,激活和测试。
3.6-alpha中的测试版本仅在单击缩略图时起作用。
<?php
/**
* Plugin Name: Remove Attachment Link-To and set to value \'none\'
*/
add_action( \'admin_footer-post-new.php\', \'wpse_76214_script\' );
add_action( \'admin_footer-post.php\', \'wpse_76214_script\' );
function wpse_76214_script() {
?>
<script type="text/javascript">
jQuery(document).ready( function($) {
$( \'li.attachment\' ).live( \'click\', function( event ) {
$( ".link-to > [value=\'none\']").attr( "selected", true ); // selected none in select field
$( ".link-to-custom" ).val( \'\' ); // clear input field for target of link
$( \'.media-sidebar div.setting\' ).remove(); // remove link field
});
} );
</script>
<?php
}
// filter a-Tag in data, there was send to edit; fallback
add_filter( \'media_send_to_editor\', \'wpse_76214_send_to_editor\', 10, 3 );
function wpse_76214_send_to_editor( $html, $id, $attachment ) {
$html = preg_replace( \'@\\<a([^>]*)>(.*?)\\<\\/a>@i\', \'$2\', $html );
return $html;
}