I'm using this code to add the alt text to my featured images on upload.
$image_title = get_post( $post->ID )->post_title; // Sanitize the title: remove hyphens, underscores & extra spaces: $image_title = preg_replace( '%\s*[-_\s]+\s*%', ' ', $image_title ); // Sanitize the title: capitalize first letter of every word (other letters lower case): $image_title = ucwords( strtolower( $image_title ) ); // Set the image Alt-Text add_post_meta( $post->ID, '_wp_attachment_image_alt', $image_title );
It's working and I can see it on it's database table
wp_postmeta under it's post ID.
Altough it's correctly registred on the database, the featured image doesn't have the Alt text (see the image bellow)
What could be the problem?