| @@ -136,14 +136,13 @@ | ||
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | protected function get_last_order_id() { |
| 139 | 139 | global $wpdb; |
| 140 | + // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Editor-preview helper; picks the newest product once per preview render. | |
| 140 | 141 | $results = $wpdb->get_col( |
| 141 | - " | |
| 142 | - SELECT MAX(ID) FROM {$wpdb->prefix}posts | |
| 143 | - WHERE post_type LIKE 'product' | |
| 144 | - AND post_status = 'publish'" | |
| 142 | + "SELECT MAX(ID) FROM {$wpdb->posts} WHERE post_type = 'product' AND post_status = 'publish'" | |
| 145 | 143 | ); |
| 144 | + // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching | |
| 146 | 145 | return reset($results); |
| 147 | 146 | } |
| 148 | 147 | |
| 149 | 148 | protected function render() { |