我找到了一个解决方案:
// Remove <img> title attribute in [gallery]
// http://wordpress.org/support/topic/wp_get_attachment_image_attributes-filter-not-working
function remove_img_title($atts) {
unset($atts[\'title\']);
return $atts;
}
add_filter(\'wp_get_attachment_image_attributes\',\'remove_img_title\', 10, 4);
// remove title attribute from <a> title attribute in [gallery]
// modified from this post : http://oikos.org.uk/2011/09/tech-notes-using-resized-images-in-wordpress-galleries-and-lightboxes/
function ah_get_attachment_link_filter( $content ) {
$new_content = preg_replace(\'/title=\\\'(.*?)\\\'/\', \'\', $content );
return $new_content;
}
add_filter(\'wp_get_attachment_link\', \'ah_get_attachment_link_filter\', 10, 4);