get_attachments();
$p_data = array();
$with_alt = 0;
$without_alt = 0;
foreach ($getAttachments as $a) {
setup_postdata($a);
$alt_meta = get_post_meta($a->ID, '_wp_attachment_image_alt', true);
$has_alt = !($alt_meta == "" || empty($alt_meta));
$skip_post = false;
if ($oct_filter == 'to-fix' && $has_alt) {
$skip_post = true;
}
if ($has_alt) {
$with_alt++;
}
else {
$without_alt++;
}
if (!$skip_post) {
$p_data[] = [
'post_id' => $a->ID,
'meta_alt' => $alt_meta,
'src' => wp_get_attachment_image_src($a->ID)[0],
'post_title' => $a->post_title,
'view_url' => get_permalink($a->ID),
'edit_url' => get_edit_post_link($a->ID) ? get_edit_post_link($a->ID) : '',
'suggestion' => $a->parent_title
];
}
}
$item_firstkey = 0 + ($paged - 1) * $items_per_page;
$pageData = array_slice($p_data, $item_firstkey, $items_per_page);
?>