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(3mo ago)10GPL-2.0-or-laterPHPPHP ^8.4CI passing

Since Feb 10Pushed 3mo 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 1mo 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

38

—

LowBetter than 85% of packages

Maintenance82

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

90d 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

[predis/predis

A flexible and feature-complete Redis/Valkey client for PHP.

7.8k305.7M2.4k](/packages/predis-predis)[snc/redis-bundle

A Redis bundle for Symfony

1.0k39.4M67](/packages/snc-redis-bundle)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)

PHPackages © 2026

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