PHPackages                             kodansha/wack-cloudfront-invalidation - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. kodansha/wack-cloudfront-invalidation

ActiveWordpress-plugin

kodansha/wack-cloudfront-invalidation
=====================================

Invalidate CloudFront caches when a post is published or updated.

v0.2.2(2mo ago)0275↓50%GPL-3.0-or-laterPHPPHP &gt;=8.2CI passing

Since Apr 12Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/kodansha/wack-cloudfront-invalidation)[ Packagist](https://packagist.org/packages/kodansha/wack-cloudfront-invalidation)[ Docs](https://github.com/kodansha/wack-cloudfront-invalidation)[ RSS](/packages/kodansha-wack-cloudfront-invalidation/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (3)Versions (14)Used By (0)

WACK CloudFront Invalidation
============================

[](#wack-cloudfront-invalidation)

**WACK CloudFront Invalidation** is a WordPress plugin that helps you to run invalidation on CloudFront after a post is published or updated.

It is designed to work with the WACK Stack, but can be used with any WordPress installation that uses CloudFront as a CDN.

How it works
------------

[](#how-it-works)

This plugin triggers invalidation for published content updates by using:

- `save_post`
- `rest_after_insert_{post_type}` (for `post` and public custom post types)

It skips autosaves, revisions, and unpublished states such as `draft` and `auto-draft`.

Installation
------------

[](#installation)

- Requires PHP 8.2 or later
- Requires WordPress 6.7 or later
- Requires Composer

### Using Composer

[](#using-composer)

```
composer require kodansha/wack-cloudfront-invalidation
```

Note

This plugin is not available on the WordPress.org plugin repository. The only installation method currently available is through Composer.

Configuration
-------------

[](#configuration)

### AWS credentials

[](#aws-credentials)

WACK CloudFront Invalidation uses AWS SDK for PHP to send invalidation requests to CloudFront, so you need to configure AWS credentials. Please refer to the [AWS SDK for PHP documentation](https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials.html)for more information on how to set up credentials.

### CloudFront Distribution ID

[](#cloudfront-distribution-id)

You can configure a CloudFront Distribution ID in either of the following ways:

1. Set `WACK_CF_INV_DISTRIBUTION_ID` in `wp-config.php` (or equivalent)
2. Enter it in the plugin settings page (`WACK Stack` &gt; `WACK CF Inv`)

```
define('WACK_CF_INV_DISTRIBUTION_ID', 'YOUR_CLOUDFRONT_DISTRIBUTION_ID');
```

Important

If `WACK_CF_INV_DISTRIBUTION_ID` is defined, it takes precedence over the value stored in the database.

Note

This plugin supports only one CloudFront Distribution ID.

### Invalidation Path Settings

[](#invalidation-path-settings)

After installing the WACK CloudFront Invalidation plugin, a settings page is added to the WordPress admin menu under **WACK Stack** &gt; **WACK CF Inv**.

In this settings page, you can configure CloudFront invalidation paths for each post type.

Important

To specify multiple paths, list them separated by line breaks. Empty lines will be ignored.

You can use the following placeholders in each path:

- `%id%`: Replaced with the post ID
- `%slug%`: Replaced with the post slug (falls back to post ID when slug is empty)

`wack_cf_inv_{post_type}_paths` filter
--------------------------------------

[](#wack_cf_inv_post_type_paths-filter)

This plugin allows you to customize the CloudFront invalidation paths per post type using a filter.

The following filter is applied before issuing a CloudFront invalidation:

```
$paths = apply_filters('wack_cf_inv_' . $post->post_type . '_paths', $paths, $post);
```

- **`{post_type}`**: Replace with your custom post type (e.g., `post`, `news`, etc.).
- **`$paths`**: Array of paths determined by the post type and the plugin settings.
- **`$post`**: The `WP_Post` object being processed.

### Example

[](#example)

To add the homepage (`/`) to the invalidation paths for the `post` post type, add the following to your theme’s `functions.php` or a custom plugin:

```
add_filter('wack_cf_inv_post_paths', function($paths, $post) {
    $paths[] = '/';
    return $paths;
}, 10, 2);
```

This filter allows you to modify or extend the list of paths to be invalidated for each post type, providing flexible cache control.

Tip

If you want to modify or extend the list of paths for the `news` post type, use `wack_cf_inv_news_paths` instead of `wack_cf_inv_post_paths`.

Tips
----

[](#tips)

### `WACK_CF_INV_DRY_RUN` constant

[](#wack_cf_inv_dry_run-constant)

Dry Run can be configured either by constant (`WACK_CF_INV_DRY_RUN`) or from the plugin settings page.

When `WACK_CF_INV_DRY_RUN` is defined, its value takes precedence over the database setting.

If Dry Run is enabled, the actual CloudFront invalidation execution will be skipped, and only log output will be performed.

You can use this for testing behavior in development environments.

### WACK Log integration

[](#wack-log-integration)

If you have the [WACK Log plugin](https://packagist.org/packages/kodansha/wack-log)installed, various logs from WACK CloudFront Invalidation will be output to standard output using WACK Log.

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance91

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~39 days

Recently: every ~3 days

Total

9

Last Release

72d ago

PHP version history (2 changes)v0.0.1PHP &gt;=8.1

v0.2.1PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/19324b7c1443d7275e10ceb66dd9004cba4a09640900791eb5c5040080ab4096?d=identicon)[kodansha](/maintainers/kodansha)

---

Top Contributors

[![5t111111](https://avatars.githubusercontent.com/u/333180?v=4)](https://github.com/5t111111 "5t111111 (20 commits)")

---

Tags

pluginwordpress

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/kodansha-wack-cloudfront-invalidation/health.svg)

```
[![Health](https://phpackages.com/badges/kodansha-wack-cloudfront-invalidation/health.svg)](https://phpackages.com/packages/kodansha-wack-cloudfront-invalidation)
```

###  Alternatives

[sybrew/the-seo-framework

An automated, advanced, accessible, unbranded and extremely fast SEO solution for any WordPress website.

47078.8k](/packages/sybrew-the-seo-framework)[afragen/git-updater

A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs.

3.3k1.6k](/packages/afragen-git-updater)[webdevstudios/cmb2-attached-posts

Custom field for CMB2 for creating post relationships.

13565.5k](/packages/webdevstudios-cmb2-attached-posts)[alleyinteractive/pest-plugin-wordpress

WordPress Pest Integration

263.7k1](/packages/alleyinteractive-pest-plugin-wordpress)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
