| 开发者 | bytecorestack |
|---|---|
| 更新时间 | 2026年8月18日 21:07 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
CreateInvalidation, GetDistribution, ListInvalidations, and GetInvalidation API requests directly.wp bcs-cfm flush all or wp bcs-cfm flush <path>./* wipeGetDistribution, ListInvalidations, and GetInvalidation individually and reports exactly which IAM action is missingdefine('AWS_ACCESS_KEY_ID', 'your_access_key_here'); define('AWS_SECRET_ACCESS_KEY', 'your_secret_key_here'); define('CLOUDFRONT_DISTRIBUTION_ID', 'your_distribution_id');
Note: AWS_DEFAULT_REGION is not needed — CloudFront's control-plane API is a single global endpoint always signed with region us-east-1, regardless of where your site or distribution lives.
Running on an EC2 instance with an IAM role attached? You can skip AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY entirely — the plugin automatically uses the instance role's temporary credentials. CLOUDFRONT_DISTRIBUTION_ID is still required.
Finding Your Distribution ID:
cloudfront:CreateInvalidation, cloudfront:GetDistribution, cloudfront:ListInvalidations, cloudfront:GetInvalidation)Install and activate this plugin, add your AWS credentials to wp-config.php, then go to Settings > CloudFront Manager and click "Purge Entire Distribution." No need to log in to the AWS Console at all.
Amazon CloudFront is AWS's content delivery network (CDN) service that caches your website content at edge locations worldwide, making your site faster for visitors globally. This plugin manages CloudFront cache invalidation specifically — clearing cached content so visitors see your latest updates.
Yes, you need an AWS account with an active Amazon CloudFront distribution and appropriate IAM permissions.
Create AWS credentials (an Access Key ID and Secret Access Key) from the AWS IAM console. Make sure the credentials have permission to manage CloudFront invalidations — see the Configuration section above for the exact IAM actions required.
Yes, if your WordPress site runs on an EC2 instance with an IAM role attached. Leave AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY undefined in wp-config.php, and the plugin will automatically fetch temporary credentials from the EC2 instance metadata service. You still need to define CLOUDFRONT_DISTRIBUTION_ID.
Use "Test Connection" on the Configuration tab to verify your access key, secret key, and distribution ID against the live CloudFront API. Use "Check Permissions" to test each required IAM action individually (GetDistribution, ListInvalidations, GetInvalidation) and see exactly which one is missing if something's misconfigured.
Yes. The plugin uses AWS Signature Version 4 for secure request signing, credentials are stored only in wp-config.php (never in the WordPress database), and no plugin option or AJAX response ever exposes your secret key. All AJAX requests are protected with WordPress nonces and a manage_options capability check.
Amazon CloudFront is AWS's standalone, full-featured CDN, while Lightsail CDN is the simplified content delivery network bundled with Lightsail distributions. This plugin is built specifically for CloudFront distributions — if you're using Lightsail CDN instead, you'll need a Lightsail-specific plugin.
Yes. Enable Auto-Clear and choose which post types (posts, pages, WooCommerce products, or any custom post type) should trigger an automatic, targeted CloudFront cache invalidation whenever they're published, updated, unpublished, or trashed.
No. Auto-Clear invalidates only the specific paths affected — the post's own permalink, its taxonomy term archives, its post-type archive, and the homepage — instead of a blanket full-site purge. A full "/*" invalidation only happens if a single change touches more than 10 paths at once, or when you explicitly click "Purge Entire Distribution."
Yes. The plugin supports interval (every 5 minutes up to every 24 hours), weekly, and monthly scheduling with customizable times. Choose the exact time and day/date for cache clearing, with a live countdown to the next run, fully aware of your WordPress site's timezone.
Yes. The Invalidation History tab lists your most recent invalidations, fetched live from the CloudFront API, with pagination and a per-invalidation path-list detail view. Nothing is stored in your WordPress database.
The plugin displays a specific, actionable error message explaining what went wrong — for example, an incorrect distribution ID, a signature/credentials mismatch, or a missing IAM permission. Use "Test Connection" and "Check Permissions" to diagnose issues before they happen.
No. Cache invalidation requests only fire when you manually clear cache, when content changes (if Auto-Clear is enabled), or during a scheduled clear — never on regular visitor page loads.
Yes. WooCommerce registers products as a custom post type, so you can enable Auto-Clear for products (and product variations) to keep your storefront's CDN cache fresh whenever inventory, pricing, or product details change.
Yes. The plugin includes WP-CLI support: run wp bcs-cfm flush all for a full distribution purge, or wp bcs-cfm flush /some/path,/another/path to invalidate specific paths — handy for firing a CloudFront cache purge automatically after a deploy.
AWS grants 1,000 free path invalidations per month; a full "/*" invalidation only counts as a single path. Beyond that allowance, standard CloudFront invalidation pricing applies. The plugin's targeted, batched invalidations are designed to make efficient use of this quota.
Yes, the plugin is compatible with WordPress multisite installations. Each site can have its own AWS credentials, distribution ID, auto-clear settings, and cache clearing schedule.
wp bcs-cfm flush all / wp bcs-cfm flush <path[,path...]>