{"id":19107778,"url":"https://github.com/alleyinteractive/wp-404-caching","last_synced_at":"2025-04-30T18:51:22.380Z","repository":{"id":226672569,"uuid":"768749520","full_name":"alleyinteractive/wp-404-caching","owner":"alleyinteractive","description":"Enables caching on 404 pages to prevent performance issues related to bad request flooding.","archived":false,"fork":false,"pushed_at":"2025-03-01T06:08:30.000Z","size":16173,"stargazers_count":8,"open_issues_count":2,"forks_count":0,"subscribers_count":19,"default_branch":"develop","last_synced_at":"2025-03-30T19:01:52.162Z","etag":null,"topics":["wordpress","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":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alleyinteractive.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-03-07T16:59:09.000Z","updated_at":"2025-02-20T11:21:31.000Z","dependencies_parsed_at":"2024-03-22T20:28:16.736Z","dependency_job_id":"b0322e0a-eecd-49ed-9b76-567820253fa8","html_url":"https://github.com/alleyinteractive/wp-404-caching","commit_stats":null,"previous_names":["alleyinteractive/wp-404-caching"],"tags_count":3,"template":false,"template_full_name":"alleyinteractive/create-wordpress-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alleyinteractive%2Fwp-404-caching","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alleyinteractive%2Fwp-404-caching/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alleyinteractive%2Fwp-404-caching/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alleyinteractive%2Fwp-404-caching/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alleyinteractive","download_url":"https://codeload.github.com/alleyinteractive/wp-404-caching/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248808802,"owners_count":21164893,"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","wordpress-plugin"],"created_at":"2024-11-09T04:13:55.273Z","updated_at":"2025-04-18T21:32:35.602Z","avatar_url":"https://github.com/alleyinteractive.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WP 404 Caching\n\n[![All Pull Request Tests](https://github.com/alleyinteractive/wp-404-caching/actions/workflows/all-pr-tests.yml/badge.svg)](https://github.com/alleyinteractive/wp-404-caching/actions/workflows/all-pr-tests.yml)\n\nA WordPress plugin to provide full page caching for 404 pages, improving performance and reducing server load.\n\n## Requirements\n\n- SSL enabled on the website.\n- An external object cache setup (e.g., Redis, Memcached).\n- Requires at least: 6.3\n- Tested up to: 6.4\n- Requires PHP: 8.1\n- License: GPL v2 or later\n\n## Description\n\nWP 404 Caching is a lightweight plugin that efficiently serves cached 404 pages to non-logged-in users. It reduces server load by storing the cached 404 page in an external object cache and returning it early in the request process.\n\nThe plugin uses a dual regular/stale caching strategy to minimize cache misses. It maintains a regular cache with a 1-hour expiration and a stale cache with a 1-day expiration. If the regular cache is empty, the stale cache is served.\n\n## Features\n\n- Full page caching for 404 pages\n- Utilizes external object cache for storing cached 404 pages\n- Dual regular/stale caching strategy to minimize cache misses\n- Automatically generates and caches 404 page via a \"guaranteed 404 URI\"\n- Triggers cache generation hourly via a cron job and immediately on cache misses\n- Sends `X-WP-404-Cache` header to indicate cache HIT/MISS status\n- Ensures compatibility with analytics by replacing the \"guaranteed 404 URI\" with the actual requested URI in the cached page\n\n## Installation\n\n### Via Composer (recommeded):\n\nYou can install the package via composer:\n\n```bash\ncomposer require alleyinteractive/wp-404-caching\n```\n### Manual install:\n\n1. Upload the `wp-404-caching` directory to your `/wp-content/plugins/` directory.\n2. Activate the plugin through the 'Plugins' menu in WordPress.\n\n## Usage\nThe plugin works out of the box with default settings. You can customize the cache expiration times by modifying the `CACHE_TIME` and `STALE_CACHE_TIME` constants in the `Full_Page_Cache_404` class.\nActivate the plugin in WordPress and use it like so:\n\n```php\nadd_filter( 'wp_404_caching_cache_time', function( $cache_time ) {\n    return 2 * HOUR_IN_SECONDS; // Set cache time to 2 hours.\n} );\n\nadd_filter( 'wp_404_caching_stale_cache_time', function( $stale_cache_time ) {\n    return 2 * DAY_IN_SECONDS; // Set stale cache time to 2 days.\n} );\n\n// Programmatically bypass the cache.\nadd_filter( 'wp_404_caching_enabled', '__return_false' );\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Credits\n\nThis project is actively maintained by [Alley\nInteractive](https://github.com/alleyinteractive). Like what you see? [Come work\nwith us](https://alley.co/careers/).\n\n- [Alley](https://github.com/Alley)\n\n## License\n\nThe GNU General Public License (GPL) license. Please see [License File](LICENSE) for more information.\n\n---\n\n# Developer Notes\n\n## Testing\n\nRun `composer test` to run tests against PHPUnit and the PHP code in the plugin.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falleyinteractive%2Fwp-404-caching","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falleyinteractive%2Fwp-404-caching","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falleyinteractive%2Fwp-404-caching/lists"}