{"id":27942865,"url":"https://github.com/beapi/log-wp-redirects","last_synced_at":"2025-05-07T11:58:32.546Z","repository":{"id":288444952,"uuid":"968118065","full_name":"BeAPI/log-wp-redirects","owner":"BeAPI","description":"Log WP Redirects is a powerful WordPress plugin that captures and logs all redirects made through WordPress's built-in `wp_redirect()` function, providing valuable insights for debugging and monitoring.","archived":false,"fork":false,"pushed_at":"2025-04-18T20:19:56.000Z","size":366,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-07T11:58:28.152Z","etag":null,"topics":["wordpress-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BeAPI.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-17T14:36:18.000Z","updated_at":"2025-04-18T20:19:59.000Z","dependencies_parsed_at":"2025-04-18T05:33:05.344Z","dependency_job_id":null,"html_url":"https://github.com/BeAPI/log-wp-redirects","commit_stats":null,"previous_names":["beapi/log-wp-redirects"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeAPI%2Flog-wp-redirects","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeAPI%2Flog-wp-redirects/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeAPI%2Flog-wp-redirects/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeAPI%2Flog-wp-redirects/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BeAPI","download_url":"https://codeload.github.com/BeAPI/log-wp-redirects/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252873977,"owners_count":21817711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["wordpress-plugin"],"created_at":"2025-05-07T11:58:31.649Z","updated_at":"2025-05-07T11:58:32.532Z","avatar_url":"https://github.com/BeAPI.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Log WP Redirects\n\n![WordPress](https://img.shields.io/badge/WordPress-5.8+-green.svg)\n![PHP](https://img.shields.io/badge/PHP-7.0+-blue.svg)\n![Version](https://img.shields.io/badge/version-1.0.3-blue.svg)\n\n**Log WP Redirects** is a powerful WordPress plugin that captures and logs all redirects made through WordPress's built-in `wp_redirect()` function, providing valuable insights for debugging and monitoring.\n\n## Features\n\n- 📊 Log all redirects with detailed information\n- 🔢 Track HTTP status codes (301, 302, 307, etc.)\n- 🔗 Record referrer URLs and request URIs\n- 🖥️ Capture user agent information\n- 👤 Track user IDs for authenticated users\n- 🌐 IP address logging (configurable)\n- 🍪 Cookie tracking (names only, not values)\n- 🔍 Full backtrace to identify redirect sources\n- 🌍 Multisite/Network compatible\n- ⏱️ Configurable log retention period\n\n## Screenshots\n\n![Settings Page](.github/assets/screenshot-settings.jpg)\n*Main settings page showing the redirect log interface.*\n\n![Detailed View](.github/assets/screenshot-detail.jpg)\n*Detailed view of a specific redirect with complete stack trace.*\n\n![Network Admin](.github/assets/screenshot-network.jpg)\n*Network admin interface for managing redirects across multiple sites.*\n\n## Installation\n\n### Standard Installation\n\n1. Upload the `log-wp-redirects` folder to your `/wp-content/plugins/` directory\n2. Activate the plugin through the 'Plugins' menu in WordPress\n3. For single sites, access logs via Tools \u003e Log WP Redirects\n4. For multisite, access network-wide logs via Network Admin \u003e Settings \u003e Log WP Redirects\n\n### Composer Installation\n\nYou can install this plugin via Composer:\n\n```bash\ncomposer require beapi/log-wp-redirects\n```\n\nOr add it to your `composer.json` file:\n\n```json\n\"require\": {\n    \"beapi/log-wp-redirects\": \"^1.0\"\n}\n```\n\n## Usage\n\nAfter installing and activating the plugin, it automatically begins capturing all redirects made using WordPress's `wp_redirect()` function.\n\n### Single Site\n\n1. Go to Tools \u003e Log WP Redirects in your WordPress admin\n2. View the comprehensive list of all redirects\n3. Click on a redirect to view detailed information including backtrace\n\n### Multisite\n\n1. Go to Network Admin \u003e Settings \u003e Log WP Redirects\n2. View redirects across all sites or filter by specific site\n3. Click on a redirect to view detailed information\n\n## Hooks \u0026 Filters\n\n### `lwr_expiration_days`\n\nCustomize how long logs are kept before being automatically deleted:\n\n```php\nadd_filter( 'lwr_expiration_days', function( $days ) {\n    return 14; // default = 7\n});\n```\n\n### `lwr_should_log_redirect`\n\nFilter which redirects should be logged based on status code or other criteria:\n\n```php\n// Example: Don't log 302 temporary redirects\nadd_filter( 'lwr_should_log_redirect', function( $should_log, $status, $location, $redirect_data ) {\n    if ( 302 === $status ) {\n        return false;\n    }\n    return $should_log;\n}, 10, 4 );\n```\n\n### `lwr_pre_insert_data`\n\nModify the data before it's inserted into the database:\n\n```php\n// Example: Remove all cookies information for privacy\nadd_filter( 'lwr_pre_insert_data', function( $data, $location, $status ) {\n    // Empty the cookies field\n    $data['cookies'] = '';\n    \n    // Or you could also sanitize/modify other fields\n    // $data['user_agent'] = 'Anonymized';\n    \n    return $data;\n}, 10, 3 );\n```\n\n## Privacy Considerations\n\nThis plugin logs IP addresses by default. If you need to comply with privacy regulations such as GDPR, you can disable IP logging by defining the following constant in your wp-config.php:\n\n```php\ndefine('LWR_LOG_IP', false);\n```\n\n## Requirements\n\n- WordPress 5.8 or higher\n- PHP 7.0 or higher\n\n## License\n\nThis project is licensed under the GPLv2 or later license.\n\n## Changelog\n\n### 1.0.3\n- Replaced custom time formatting with WordPress native human_time_diff() function\n- Added Composer support for easier installation in modern WordPress projects\n- Improved WP-Cron implementation using standard WordPress activation/deactivation hooks\n- Switched from single events to properly scheduled daily events for log cleanup\n- Added optimized database indexes for better performance, especially for cleanup operations\n- Added a composite index (blog_id, date_added) to significantly improve cleanup query performance\n\n### 1.0.2\n- Added support for the `$x_redirect_by` parameter of wp_redirect() function\n- The source of redirects is now tracked and displayed in the admin interface\n- Enhanced database structure to accommodate the new data\n- Improved database schema management using WordPress's dbDelta() function\n- Added new filter `lwr_pre_insert_data` to modify data before database insertion\n- Increased field size for x_redirect_by from 100 to 255 characters\n\n### 1.0.1\n- Added new filter `lwr_should_log_redirect` to control which redirects are logged\n- Improved code documentation\n\n### 1.0.0\n- Initial release\n\n## Credits\n\nDeveloped by [Be API](https://beapi.fr) ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeapi%2Flog-wp-redirects","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeapi%2Flog-wp-redirects","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeapi%2Flog-wp-redirects/lists"}