Добавьте следующий код в ваши активные темы functions.php
add_filter('wp_get_attachment_image_attributes', 'change_attachement_image_attributes_add_alttopost', 20, 2);
function change_attachement_image_attributes_add_alttopost( $attr, $attachment ){
// Get post parent
$parent = get_post_field( 'post_parent', $attachment);
// Get post type to check if it's post you can also add to any post type
$type = get_post_field( 'post_type', $parent);
if( $type != 'post' ){
return $attr;
}
/// Get title
$title = get_post_field( 'post_title', $parent);
$attr['alt'] = $title;
$attr['title'] = $title;
return $attr;
}