How to get Image alt Attribute in WordPress
I will show you exactly how I get an image alt attribute in WordPress, with the get_post_meta applying simple following code in WordPress.
#functions.php
global $wpdb;
$image_name = get_theme_mod( 'normal_logo_image',normal_logo_image);
$attachment_light = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_name ));
$image_alt_light = get_post_meta( $attachment_light[0], '_wp_attachment_image_alt', true);