true));
}
/**
* Dashboard callback
*/
public function main_page_callback() {
?>
'attachment',
'post_mime_type' => 'image',
'post_status' => 'inherit',
'posts_per_page' => -1,
));
/**
* Create array with all our images data
*/
$images = array();
if( !empty($images_query->posts) ){
foreach ($images_query->posts as $img) {
$alt = get_post_meta($img->ID, '_wp_attachment_image_alt', true);
if(strlen($alt) === 0) {
$images[] = array(
'id' => $img->ID,
'name' => $img->post_title,
'url' => wp_get_attachment_thumb_url($img->ID)
);
}
}
}
/**
* Update post meta with the new Alternative text
*/
if( isset($_POST['acwpAddAlt']) ){
update_post_meta(sanitize_text_field($_POST['thumb_id']), '_wp_attachment_image_alt', sanitize_text_field($_POST['thumb_alt']));
echo '
';
}
?>