WP Manifestindependent plugin directory
manifest / performance / divi-section-fragment-cache

Divi Section Fragment Cache

Divi Section Fragment Cache

by szepeviktor · github.com/szepeviktor/divi-section-fragment-cache

1stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/szepeviktor/divi-section-fragment-cache/archive/refs/heads/master.zip

Readme

Divi Section Fragment Cache

WordPress plugin that fragment-caches top-level Divi sections and skips caching for sections that contain denylisted shortcodes or the dsec-no-cache CSS class.

What it does

  • Hooks into the_content on singular frontend requests.
  • Splits the content into top-level [et_pb_section]...[/et_pb_section] blocks.
  • Renders each eligible section once and stores a render snapshot in a transient for one day.
  • Bypasses the cache for sections that contain shortcodes from the deny list.
  • Bypasses the cache for sections with dsec-no-cache in the section CSS class field.
  • Bypasses the plugin entirely on password-protected posts.
  • Bypasses the plugin entirely during Divi frontend builder requests detected by et_core_is_fb_enabled().
  • Replays captured Divi side effects on cache hit before returning cached HTML.

Snapshot contents

The current cache payload is not HTML-only.

Depending on what Divi records during section rendering, the plugin may store and replay:

  • html
  • animation_data
  • link_options_data
  • scroll effects state
  • WordPress lazy-loading disable state
  • enqueued stylesheet handles
  • enqueued script handles
  • generated CSS deltas
  • font queue deltas
  • et_pb_subjects_cache deltas

Important limitation

This plugin only works reliably when the content is made only of et_pb_section shortcodes.

If the content contains other top-level markup or shortcode structures outside Divi sections, those parts are passed through unchanged and the cache strategy may not match the layout you expect.

The plugin also relies on inferred Divi runtime side effects rather than an official Divi snapshot API, so compatibility should still be treated as partial rather than complete.

To reduce editor risk, the plugin does not run during Divi frontend builder requests.

Password-protected posts are also excluded because WordPress replaces their public content with a password form until the visitor unlocks the post, and the unlocked render depends on password-cookie state.

Deny list customization

The plugin ships with a built-in deny list for known dynamic shortcodes in these plugins:

  • gravityforms
  • divi-event-calendar-module

You will likely need to customize this deny list for your own site so that any shortcode producing user-specific, time-sensitive, or otherwise dynamic output is excluded from fragment caching.

At the moment the deny list is defined in divi-section-fragment-cache.php as the Plugin::DENYLIST constant, so customization currently means editing that list in code.

Per-section cache bypass

Add dsec-no-cache to a Divi section's CSS class field to force that section to render fresh on every request.

The section remains part of normal Divi rendering; it is only excluded from fragment cache reads and writes.

Installation

  1. Copy the plugin into your WordPress plugins directory.
  2. Activate Divi Section Fragment Cache.
  3. Review the deny list before using it in production.

Notes

  • Cached render snapshots are stored in transients for DAY_IN_SECONDS.
  • Cache keys are based on the post ID, section index, and section content hash.
  • Sections with unbalanced et_pb_section shortcode nesting are not cached.

Read the full README on GitHub →