prefix . 'redirects_404'; $offset = ($page - 1) * $per_page; // Base query $where_clause = "WHERE 1=1"; $params = array(); // Add search filter if (!empty($search)) { $where_clause .= " AND url LIKE %s"; $params[] = '%' . $wpdb->esc_like($search) . '%'; } // Validate order by column - WordPress style column names $allowed_columns = ['last_redirected', 'url', 'count']; if (!in_array($order_by, $allowed_columns)) { $order_by = 'last_redirected'; } // Validate order direction $order_dir = strtoupper($order_dir); if (!in_array($order_dir, ['ASC', 'DESC'])) { $order_dir = 'DESC'; } // Get total count for pagination $total_query = "SELECT COUNT(*) FROM {$table_name} {$where_clause}"; if (!empty($params)) { $total_items = $wpdb->get_var($wpdb->prepare($total_query, $params)); } else { $total_items = $wpdb->get_var($total_query); } // Get paginated results $query = "SELECT * FROM {$table_name} {$where_clause} ORDER BY {$order_by} {$order_dir} LIMIT %d OFFSET %d"; $query_params = array_merge($params, [$per_page, $offset]); $results = $wpdb->get_results($wpdb->prepare($query, $query_params), ARRAY_A); return array( 'data' => $results, 'total' => (int)$total_items, 'pages' => ceil($total_items / $per_page), 'current_page' => $page ); } // Function to build WordPress-style column sort URL function get_column_sort_url($column, $current_order_by, $current_order_dir) { $new_order_dir = 'ASC'; // If clicking the same column, toggle direction if ($current_order_by === $column) { $new_order_dir = ($current_order_dir === 'ASC') ? 'DESC' : 'ASC'; } $current_url = remove_query_arg(['orderby', 'order'], $_SERVER['REQUEST_URI']); $sort_url = add_query_arg([ 'orderby' => $column, 'order' => strtolower($new_order_dir), 'paged' => 1 // Reset to first page when sorting ], $current_url); return $sort_url; } $options = P404REDIRECT_get_my_options(); function p404_cleanup_image_options() { $options = P404REDIRECT_get_my_options(); $image_id = isset($options['image_id_p404_redirect_to']) ? absint($options['image_id_p404_redirect_to']) : ''; if ($image_id != '') { $image_data = wp_get_attachment_image_src($image_id); if (!$image_data || empty($image_data[0])) { // Image doesn't exist, clear the option $options['image_id_p404_redirect_to'] = ''; update_option('p404_redirect_options', $options); return false; } } return true; } ?> '; echo '
Cache Plugin Detected: You have a cache plugin installed (' . P404REDIRECT_there_is_cache() . '). Please clear your cache after making changes for them to take effect immediately.
'; echo ''; } // Get the current email options (add defaults if they don't exist) $email_enabled = P404REDIRECT_read_option_value('email_notifications_enabled', '1'); // Default: enabled $email_frequency = P404REDIRECT_read_option_value('email_frequency', 'weekly'); // Default: Weekly $notification_email = P404REDIRECT_read_option_value('notification_email', get_option('admin_email')); // Default: Admin email ?>Manage your 404 error redirections and broken image handling with professional-grade controls
Plugin installed on:
| # | Last Redirected | URL | Redirect Count |
|---|---|---|---|
No Results FoundNo URLs match your search for "" Clear search to see all results. No 404 Redirects YetWhen visitors encounter 404 errors, they'll appear here. |
|||