array( 'page', 'post' ), 'posts_per_page' => -1, 'post_status' => 'publish', 'orderby' => 'title', 'order' => 'ASC', ) ); // Last scan date for header subtitle. $accessiq_sc_last_posts = get_posts( array( 'post_type' => ACCESSIQ_SCAN_CPT, 'posts_per_page' => 1, 'orderby' => 'date', 'order' => 'DESC', ) ); // phpcs:ignore WordPress.DateTime.CurrentTimeTimestamp.Requested $accessiq_sc_last_date = ! empty( $accessiq_sc_last_posts ) ? human_time_diff( get_post_time( 'U', false, $accessiq_sc_last_posts[0] ), current_time( 'timestamp' ) ) . ' ' . __( 'ago', 'accessiq' ) : null; // History card: last 6 scans (CSS bar chart). $accessiq_sc_hist_posts = get_posts( array( 'post_type' => ACCESSIQ_SCAN_CPT, 'posts_per_page' => 6, 'orderby' => 'date', 'order' => 'DESC', ) ); $accessiq_sc_hist_latest = ! empty( $accessiq_sc_hist_posts ) ? $accessiq_sc_hist_posts[0]->ID : 0; // History tab: last 20 scans table. $accessiq_sc_all_scans = get_posts( array( 'post_type' => ACCESSIQ_SCAN_CPT, 'posts_per_page' => 20, 'orderby' => 'date', 'order' => 'DESC', ) ); $accessiq_sc_default_level = $accessiq_sc_settings->get( 'scan_level', 'AA' ); // Score History: distinct scanned URLs for dropdown. global $wpdb; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching $accessiq_sc_history_urls = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT pm.meta_value FROM {$wpdb->postmeta} pm INNER JOIN {$wpdb->posts} p ON pm.post_id = p.ID WHERE pm.meta_key = %s AND p.post_type = %s AND p.post_status = 'publish' AND pm.meta_value != '' ORDER BY pm.meta_value ASC", '_accessiq_url', ACCESSIQ_SCAN_CPT ) ); ?>

📊