你可以试试过滤器wp_get_attachment_link
// definition: apply_filters( \'wp_get_attachment_link\', "<a href=\'" . esc_url( $url ) . "\'>$link_text</a>", $id, $size, $permalink, $icon, $text, $attr );
// this filter provide a max. of 7 arguments, I use 2 in the example
add_filter( \'wp_get_attachment_link\', \'q363693_update_attachment_link\', 10, 2 );
function q363693_update_attachment_link( $url, $id ) {
// some codes
$new_link = "<a href=\'" . get_permalink( $id ) . "\'>your own text or anything you need or add more arguments to use the original text...</a>";
return $new_link;
}