admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('ait_iat_regen_alt_nonce') ]); } public function add_alt_button_to_attachment($response, $attachment, $meta) { $response['ait_iat_regen_button'] = sprintf( '', $attachment->ID ); return $response; } public function add_alt_status_icon( $response, $attachment, $meta ) { $alt = get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ); // Determine class $status_class = $alt ? 'ait-iat-has-alt' : 'ait-iat-no-alt'; // Add our custom field so Backbone template has the info $response['ait_iat_alt_status'] = $status_class; return $response; } public function add_regen_action_link($actions, $post) { if ($post->post_type !== 'attachment') return $actions; $mime = get_post_mime_type($post->ID); if (!AIT_IAT_Media_Handler::mime_is_supported($mime)) return $actions; $url = add_query_arg([ 'action' => 'ait_iat_regen_single', 'post_id' => $post->ID, ], admin_url('admin-post.php')); $actions['ait_iat_regen'] = '' . esc_html__('AI Regenerate Alt Text', 'ai-image-alt-text') . ''; return $actions; } }