' . esc_html__( 'You are not allowed to access this taxonomy.', 'ai-for-seo' ) . '

'; return; } // phpcs:disable WordPress.Security.NonceVerification.Recommended -- Read-only list filters under the content-role and taxonomy-capability gates. $ai4seo_taxonomy_availability = isset( $_GET['ai4seo_taxonomy_availability'] ) && is_string( $_GET['ai4seo_taxonomy_availability'] ) ? sanitize_key( wp_unslash( $_GET['ai4seo_taxonomy_availability'] ) ) : 'active'; $ai4seo_taxonomy_search = isset( $_GET['ai4seo_search'] ) && is_string( $_GET['ai4seo_search'] ) ? sanitize_text_field( wp_unslash( $_GET['ai4seo_search'] ) ) : ''; $ai4seo_taxonomy_page = isset( $_GET['ai4seo_page'] ) && is_scalar( $_GET['ai4seo_page'] ) ? max( 1, absint( $_GET['ai4seo_page'] ) ) : 1; $ai4seo_taxonomy_missing_only = isset( $_GET['ai4seo_filter_status'] ) && 'missing' === $_GET['ai4seo_filter_status']; // phpcs:enable WordPress.Security.NonceVerification.Recommended $ai4seo_taxonomy_list = ai4seo_read_taxonomy_proxy_list_page( $ai4seo_current_taxonomy, $ai4seo_taxonomy_availability, $ai4seo_taxonomy_search, $ai4seo_taxonomy_page, $ai4seo_taxonomy_missing_only ); if ( is_wp_error( $ai4seo_taxonomy_list ) ) { echo ''; return; } // Reuse the post/media control layout while retaining the taxonomy-specific route and filters. $ai4seo_taxonomy_filter_status = $ai4seo_taxonomy_missing_only ? 'missing' : 'all'; echo '
'; echo '
    '; foreach ( array( 'active' => __( 'Active', 'ai-for-seo' ), 'inactive' => __( 'Inactive (read-only)', 'ai-for-seo' ), 'all' => __( 'All', 'ai-for-seo' ), ) as $ai4seo_filter_value => $ai4seo_filter_label ) { $ai4seo_filter_url = ai4seo_get_post_type_page_url( AI4SEO_TAXONOMY_PROXY_POST_TYPE, 1, array( 'ai4seo_taxonomy' => $ai4seo_current_taxonomy, 'ai4seo_taxonomy_availability' => $ai4seo_filter_value, 'ai4seo_search' => $ai4seo_taxonomy_search, 'ai4seo_filter_status' => $ai4seo_taxonomy_filter_status, ) ); echo '
  • ' . ( 'active' !== $ai4seo_filter_value ? ' | ' : '' ) . '' . esc_html( $ai4seo_filter_label ) . '
  • '; } echo '
'; if ( $ai4seo_taxonomy_missing_only ) { $ai4seo_remove_missing_url = ai4seo_get_post_type_page_url( AI4SEO_TAXONOMY_PROXY_POST_TYPE, 1, array( 'ai4seo_taxonomy' => $ai4seo_current_taxonomy, 'ai4seo_taxonomy_availability' => $ai4seo_taxonomy_availability, 'ai4seo_search' => $ai4seo_taxonomy_search, ) ); echo '' . esc_html__( 'Missing fields', 'ai-for-seo' ) . ' '; } echo '
'; if ( $ai4seo_taxonomy_list['rows'] ) { echo '
'; ai4seo_echo_wp_kses( ai4seo_get_bulk_generation_queue_action_controls( AI4SEO_BULK_GENERATION_QUEUE_CONTEXT_METADATA, 'ai4seo_bulk_generation_queue_post_ids', 'all', array( 'list_location' => 'taxonomy' ) ) ); echo '
'; } echo '
'; echo esc_html( $ai4seo_taxonomy_list['has_errors'] ? __( 'Entry count unavailable', 'ai-for-seo' ) : sprintf( /* translators: %s: Number of entries matching the current filters. */ _n( '%s entry', '%s entries', $ai4seo_taxonomy_list['total'], 'ai-for-seo' ), ai4seo_format_number_i18n( $ai4seo_taxonomy_list['total'] ) ) ); echo '
'; if ( $ai4seo_taxonomy_list['index_pending'] ) { echo '

' . esc_html__( 'Some taxonomy entries are still waiting for synchronization. They will appear after a scheduled update; reload this page afterwards. If this message persists, check that WordPress scheduled tasks are running.', 'ai-for-seo' ) . '

'; } if ( $ai4seo_taxonomy_list['has_errors'] ) { echo ''; } $ai4seo_taxonomy_ids = array_column( $ai4seo_taxonomy_list['rows'], 'post_id' ); $ai4seo_taxonomy_page_inspections = array(); $ai4seo_taxonomy_generation_status = ai4seo_read_taxonomy_generation_status_summary( $ai4seo_current_taxonomy, false, $ai4seo_taxonomy_page_inspections, $ai4seo_taxonomy_ids ); $ai4seo_taxonomy_field_states = array(); $ai4seo_taxonomy_issues = array(); $ai4seo_taxonomy_coverage = ai4seo_read_percentage_of_available_metadata_by_post_ids( $ai4seo_taxonomy_ids, 0, $ai4seo_taxonomy_metadata_known, $ai4seo_taxonomy_field_states, $ai4seo_taxonomy_issues ); $ai4seo_taxonomy_fields = ai4seo_get_active_meta_tags(); $ai4seo_taxonomy_field_names = array(); foreach ( $ai4seo_metadata_field_descriptors as $ai4seo_field_identifier => $ai4seo_field_details ) { if ( in_array( $ai4seo_field_identifier, $ai4seo_taxonomy_fields, true ) && isset( $ai4seo_field_details['name'] ) ) { $ai4seo_taxonomy_field_names[ $ai4seo_field_identifier ] = $ai4seo_field_details['name']; } } echo '
'; echo ''; foreach ( array( __( 'Name', 'ai-for-seo' ), __( 'Parent', 'ai-for-seo' ), __( 'Content count', 'ai-for-seo' ), __( 'Metadata coverage', 'ai-for-seo' ), __( 'Actions', 'ai-for-seo' ) ) as $ai4seo_column_label ) { echo ''; } echo ''; foreach ( $ai4seo_taxonomy_list['rows'] as $ai4seo_taxonomy_row ) { $ai4seo_id = $ai4seo_taxonomy_row['post_id']; $ai4seo_parent = $ai4seo_taxonomy_row['source']['parent'] && $ai4seo_taxonomy_row['taxonomy'] ? get_term( $ai4seo_taxonomy_row['source']['parent'], $ai4seo_current_taxonomy ) : null; $ai4seo_percentage = $ai4seo_taxonomy_coverage[ $ai4seo_id ] ?? null; $ai4seo_known = $ai4seo_taxonomy_metadata_known && null !== $ai4seo_percentage; echo ''; echo ''; echo ''; echo ''; } if ( ! $ai4seo_taxonomy_list['rows'] && ! $ai4seo_taxonomy_list['has_errors'] ) { echo ''; } echo '
'; ai4seo_echo_wp_kses( ai4seo_get_select_all_checkbox( 'ai4seo_bulk_generation_queue_post_ids', '' ) ); echo '' . esc_html( $ai4seo_column_label ) . '
'; if ( ai4seo_can_edit_taxonomy_proxy( $ai4seo_id ) ) { ai4seo_echo_wp_kses( ai4seo_get_bulk_generation_queue_entry_checkbox( 'ai4seo_bulk_generation_queue_post_ids', $ai4seo_id, $ai4seo_taxonomy_row['name'], $ai4seo_known ? '' : __( 'Stored metadata is unavailable.', 'ai-for-seo' ) ) ); } echo ''; if ( $ai4seo_taxonomy_row['archive_url'] ) { echo '' . esc_html( $ai4seo_taxonomy_row['name'] ) . ''; } else { echo esc_html( $ai4seo_taxonomy_row['name'] ); } echo ''; if ( ! $ai4seo_taxonomy_row['available'] ) { echo ' ' . esc_html__( 'Inactive', 'ai-for-seo' ) . ''; } echo '
' . esc_html( $ai4seo_taxonomy_row['source']['slug'] ) . '
' . esc_html( $ai4seo_parent && ! is_wp_error( $ai4seo_parent ) ? $ai4seo_parent->name : '—' ) . '' . esc_html( number_format_i18n( $ai4seo_taxonomy_row['source']['count'] ) ) . ''; if ( $ai4seo_taxonomy_fields ) { // The shared reader excludes taxonomy proxies from third-party providers and preserves unknown coverage. // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Shared coverage renderer escapes dynamic output, including field details and meter attributes. echo ai4seo_get_seo_coverage_progress_bar_tag( $ai4seo_id, $ai4seo_percentage, '', null === $ai4seo_percentage || $ai4seo_percentage < 100, $ai4seo_taxonomy_row['label'], $ai4seo_taxonomy_field_names, $ai4seo_taxonomy_field_states[ $ai4seo_id ] ?? array() ); } else { echo '
' . esc_html__( 'No active meta tags.', 'ai-for-seo' ) . '
'; } if ( is_wp_error( $ai4seo_taxonomy_generation_status ) ) { echo '
' . esc_html__( 'Status unavailable', 'ai-for-seo' ) . '
'; } else { foreach ( array( 'processing' => __( 'Processing', 'ai-for-seo' ), 'pending' => __( 'Queued', 'ai-for-seo' ), 'failed' => __( 'Needs review', 'ai-for-seo' ), 'auto_queue_disallowed' => __( 'Automatic queueing excluded', 'ai-for-seo' ), ) as $ai4seo_generation_status_key => $ai4seo_generation_status_label ) { if ( in_array( $ai4seo_id, $ai4seo_taxonomy_generation_status[ $ai4seo_generation_status_key ], true ) ) { echo '
' . esc_html( $ai4seo_generation_status_label ) . '
'; break; } } } if ( $ai4seo_taxonomy_row['available'] ) { $ai4seo_generation_context = ai4seo_get_taxonomy_generation_eligibility( $ai4seo_id ); if ( is_wp_error( $ai4seo_generation_context ) ) { echo '
' . esc_html__( 'Content could not be read', 'ai-for-seo' ) . '
'; } elseif ( ! $ai4seo_generation_context['has_sufficient_content'] ) { echo '
' . esc_html__( 'Too little content for automatic generation', 'ai-for-seo' ) . '
'; } } echo '
'; ai4seo_echo_wp_kses( ai4seo_get_edit_metadata_button( $ai4seo_id, $ai4seo_taxonomy_ids, $ai4seo_taxonomy_row['label'], $ai4seo_taxonomy_row['available'] && $ai4seo_known && $ai4seo_percentage < 100 ) ); ai4seo_echo_wp_kses( ai4seo_get_wordpress_post_edit_link_button( $ai4seo_id ) ); echo '
' . esc_html__( 'No entries match these filters.', 'ai-for-seo' ) . '
'; $ai4seo_taxonomy_pagination = paginate_links( array( 'base' => ai4seo_get_post_type_page_url( AI4SEO_TAXONOMY_PROXY_POST_TYPE, 0, array( 'ai4seo_taxonomy' => $ai4seo_current_taxonomy, 'ai4seo_taxonomy_availability' => $ai4seo_taxonomy_availability, 'ai4seo_search' => $ai4seo_taxonomy_search, 'ai4seo_filter_status' => $ai4seo_taxonomy_filter_status, ) ), 'total' => max( 1, (int) ceil( $ai4seo_taxonomy_list['total'] / 20 ) ), 'current' => $ai4seo_taxonomy_list['page'], ) ); if ( $ai4seo_taxonomy_pagination ) { echo '
'; ai4seo_echo_wp_kses( ai4seo_normalize_pagination_links( $ai4seo_taxonomy_pagination ) ); echo '
'; }