Automattic / Automattic/jetpack

Subscription block stops caching for admin users

Open
#38,152 3 comments 0 reactions 0 assignees View on GitHub
[Feature] Subscriptions [Plugin] Jetpack [Plugin] Super Cache [Pri] Low Bug Triaged
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

### Impacted plugin

Jetpack

### Quick summary

The Subscriptions block at extensions/blocks/subscriptions/subscriptions.php sets DONOTCACHEPAGE on line 1033 when an admin user is logged in regardless of whether a subscription block is being shown on the current page.

ref: p1707741294383739/1707737397.873219-slack-C016BBAFHHS

### Steps to reproduce

1. Enable the newsletter feature in Jetpack.
2. In WP Super Cache enable caching for all
3. Enable debugging in WPSC
4. Visit the blog as an admin user and note that DONOTCACHEPAGE is set so that no caching is done.

### A clear and concise description of what you expected to happen.

The page should be cached as WP Super Cache is configured to allow it.

### What actually happened

The page was not cached.

### Impact

Some (< 50%)

### Available workarounds?

Yes, easy to implement

### Platform (Simple and/or Atomic)

_No response_

### Logs or notes

Instead of checking for the admin user, it should probably check for the subscription cookie, I think. I haven't used the premium features of this block and I'm not 100% certain how it works.

Contributor guide

Open the contributing guide

Research direction

Start in extensions/blocks/subscriptions/subscriptions.php around line 1033 and inspect when DONOTCACHEPAGE is set for logged-in admins. Reproduce with Jetpack newsletter enabled and WP Super Cache configured to cache all pages, then compare pages with and without the Subscriptions block. Done means pages without the block remain cacheable while subscription behavior continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.