PHPackages                             xwp/block-visibility-edge-cache - 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. [Caching](/categories/caching)
4. /
5. xwp/block-visibility-edge-cache

ActiveWordpress-plugin[Caching](/categories/caching)

xwp/block-visibility-edge-cache
===============================

Handles edge cache invalidation for blocks with time-based visibility settings.

1.0.0(6mo ago)20GPL-2.0-or-laterPHPPHP ^8.4CI passing

Since Feb 10Pushed 6mo agoCompare

[ Source](https://github.com/xwp/block-visibility-edge-cache)[ Packagist](https://packagist.org/packages/xwp/block-visibility-edge-cache)[ RSS](/packages/xwp-block-visibility-edge-cache/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (6)Versions (4)Used By (0)

Block Visibility Edge Cache
===========================

[](#block-visibility-edge-cache)

[![Test](https://github.com/xwp/block-visibility-edge-cache/actions/workflows/test.yml/badge.svg)](https://github.com/xwp/block-visibility-edge-cache/actions/workflows/test.yml)

A WordPress plugin that integrates the [Block Visibility](https://wordpress.org/plugins/block-visibility/) plugin with WordPress.com VIP edge caching. It ensures that edge caches are automatically purged at the exact moment a block's visibility is scheduled to change.

How it Works
------------

[](#how-it-works)

When using edge caching, page content is cached at the "edge" (servers closer to the user). Traditional "Date/Time" visibility rules in the Block Visibility plugin usually rely on PHP executing during the page load to decide whether to show or hide a block. With edge caching, PHP might not run for every request, leading to stale content being served even after a visibility transition should have occurred.

This plugin solves this by:

1. Parsing the blocks in a post when it is saved or published.
2. Calculating all future "transition" timestamps (when a block should appear or disappear) based on the Date/Time settings.
3. Scheduling background tasks using [Action Scheduler](https://actionscheduler.org/) to purge the post's edge cache at those specific timestamps.

Requirements
------------

[](#requirements)

- PHP 8.4+
- WordPress 6.0+
- [Block Visibility](https://wordpress.org/plugins/block-visibility/) plugin
- [Action Scheduler](https://actionscheduler.org/) (bundled with the plugin or available via WooCommerce)

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

[](#installation)

### Via Composer (Recommended)

[](#via-composer-recommended)

```
composer require xwp/block-visibility-edge-cache
```

### Manual

[](#manual)

1. Upload the plugin folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Ensure the Block Visibility plugin is also active.

Supported Visibility Controls
-----------------------------

[](#supported-visibility-controls)

To maintain compatibility with edge caching, only **time-based** visibility controls are supported:

- **Date Range:** Specific start and end dates/times.
- **Seasonal:** Recurring date ranges every year.
- **Day of Week:** Showing/hiding blocks on specific days.
- **Time of Day:** Showing/hiding blocks during specific hours.

### Disabled Controls

[](#disabled-controls)

The following controls are automatically disabled because they depend on dynamic request data (visitor-specific) which is incompatible with static edge caching:

- Browser / Device
- Cookie
- Location
- Role / User
- Screen Size
- URL Path / Query String
- Referral Source
- WooCommerce / EDD / WP Fusion integration
- ACF fields

Developer Hooks
---------------

[](#developer-hooks)

### `xwp_block_visibility_edge_cache_purged`

[](#xwp_block_visibility_edge_cache_purged)

Triggered after a post's edge cache has been purged. Useful for adding custom purging logic for other cache layers.

```
add_action( 'xwp_block_visibility_edge_cache_purged', function( $post_id ) {
    // Custom purging logic here.
} );
```

Local Development &amp; Testing
-------------------------------

[](#local-development--testing)

### Installation

[](#installation-1)

```
composer install
pnpm install
```

### Running Tests

[](#running-tests)

The project includes a comprehensive test suite using PHPUnit via wp-env.

```
# Start the WordPress environment
pnpm wp-env start

# Run PHPUnit tests
pnpm test:php

# Run PHP Code Sniffer
composer lint

# Run PHPStan
composer phpstan
```

License
-------

[](#license)

GPLv2 or later.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance68

Regular maintenance activity

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

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

Unknown

Total

1

Last Release

189d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/415bc53586018077324af64dad074bf430ba1b72471550489372668274a13b12?d=identicon)[xwp](/maintainers/xwp)

---

Top Contributors

[![PatelUtkarsh](https://avatars.githubusercontent.com/u/5015489?v=4)](https://github.com/PatelUtkarsh "PatelUtkarsh (8 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/xwp-block-visibility-edge-cache/health.svg)

```
[![Health](https://phpackages.com/badges/xwp-block-visibility-edge-cache/health.svg)](https://phpackages.com/packages/xwp-block-visibility-edge-cache)
```

###  Alternatives

[wp-pay/core

Core components for the WordPress payment processing library.

26121.9k125](/packages/wp-pay-core)[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21114.2k](/packages/iazaran-smart-cache)[wp-pay-extensions/gravityforms

Gravity Forms driver for the WordPress payment processing library.

1134.5k5](/packages/wp-pay-extensions-gravityforms)[ichhabrecht/intcache

Turn uncachable page objects into cacheable links

193.9k](/packages/ichhabrecht-intcache)

PHPackages © 2026

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