Skip to content

VideoPress: add a site-level setting to disable auto-generated captions#50014

Open
obenland wants to merge 4 commits into
trunkfrom
vidp-263-videopress-add-an-option-to-disable-auto-generated-captions
Open

VideoPress: add a site-level setting to disable auto-generated captions#50014
obenland wants to merge 4 commits into
trunkfrom
vidp-263-videopress-add-an-option-to-disable-auto-generated-captions

Conversation

@obenland

Copy link
Copy Markdown
Member

Fixes VIDP-263

Proposed changes

Adds a site-level opt-out for auto-generated captions. Since auto-subtitle generation shipped for all uploads, there has been no customer-facing way to turn it off — only per-video removal via the block's Text Tracks tool. This adds a "Captions" toggle so a site owner can disable auto-caption generation for all new videos at once.

  • New Captions card in the new DataViews-based VideoPress settings UI (routes/settings/stage.tsx) with an "Automatically generate captions for new videos" toggle. The toggle is on by default (captions stay enabled unless explicitly turned off). Not added to the legacy Jetpack admin settings UI.
  • New site option videopress_auto_generated_captions_disabled (boolean, default false), exposed and updated through the existing videopress/v1/settings REST endpoint.
  • Option added to the Sync default options allowlist so it replicates to WordPress.com.

Why an opt-out flag (_disabled) rather than an "enabled" flag

Modeled as a *_disabled flag defaulting to false (matching the existing videopress_private_enabled_for_site pattern) so the value persists reliably. update_option() short-circuits when the new value equals the stored value, and an absent option reads as false — so a "default-true / enabled" model could never persist the off state on a fresh site. The opt-out framing avoids that entirely; the UI inverts it back to a positive "captions on" toggle for the user.

While here, the REST args were cleaned up to rely on the schema (type => boolean) for sanitization via get_param(), dropping the redundant explicit sanitize_callback/required and the manual boolval().

Required WordPress.com-side change (separate PR in contexta8c)

This Jetpack PR stores and syncs the option but does not (and cannot) change caption generation, which runs on WordPress.com infrastructure. The wpcom side needs:

  1. Replicastore allowlist — add videopress_auto_generated_captions_disabled to WPcom's shadow replicastore options allowlist. Sync only sends the option once it's allowlisted here; WPcom independently filters what it retains, so without the wpcom-side entry the value arrives but is dropped.
  2. Honor the option in the caption-generation pipeline — before enqueuing/running auto-caption generation for a newly uploaded VideoPress video, check the blog's videopress_auto_generated_captions_disabled option and skip generation when it is truthy.
    • Jetpack / Atomic sites: read the value replicated to the blog's cache site via Sync.
    • Simple sites: the setting endpoint writes update_option() directly on the wpcom blog, so the pipeline reads it from the same blog options.

Scope here is intentionally the opt-out for new uploads; bulk-clearing existing auto-generated tracks (also mentioned in the ticket) is out of scope for this PR.

Does this pull request change what data or activity we track or use?

No new tracking. It adds one synced boolean site option (videopress_auto_generated_captions_disabled).

Testing instructions

  • Build the VideoPress package / plugin and open the new DataViews-based VideoPress Settings screen.
  • Confirm a Captions card appears with "Automatically generate captions for new videos", toggled on by default.
  • Toggle it off; confirm the change persists across a reload (verify wp option get videopress_auto_generated_captions_disabled returns 1).
  • Toggle it back on; confirm the option becomes 0/false.
  • Confirm the legacy Jetpack admin VideoPress settings UI is unchanged (no new toggle there).
  • Automated: jetpack test php packages/videopress (Data + settings coverage) and jetpack jest packages/videopress --testPathPattern use-settings pass.

Adds an opt-out for auto-generated captions in the new DataViews-based
VideoPress settings UI. Auto-captions remain on by default; the site
owner can turn them off via a new "Captions" card.

Modeled as an opt-out flag (videopress_auto_generated_captions_disabled,
default false) so the value persists reliably even on a fresh site —
update_option() short-circuits when writing false to an absent option,
so an "enabled, default true" model could never store the off state.

The option is synced to WordPress.com so the caption-generation pipeline
can honor it (see PR description for the required wpcom-side change).

VIDP-263

Claude-Session: https://claude.ai/code/session_01K4JTgKPiD3XYk9CKb19Zoa
@obenland obenland requested a review from a team as a code owner June 26, 2026 20:03
Copilot AI review requested due to automatic review settings June 26, 2026 20:03
@obenland obenland requested a review from a team as a code owner June 26, 2026 20:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the vidp-263-videopress-add-an-option-to-disable-auto-generated-captions branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack vidp-263-videopress-add-an-option-to-disable-auto-generated-captions
bin/jetpack-downloader test jetpack-mu-wpcom-plugin vidp-263-videopress-add-an-option-to-disable-auto-generated-captions

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [Package] Sync [Package] VideoPress [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests labels Jun 26, 2026
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: July 7, 2026
    • Code freeze: July 6, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jun 26, 2026
@obenland obenland added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Jun 26, 2026
@jp-launch-control

jp-launch-control Bot commented Jun 26, 2026

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/packages/videopress/src/dashboard/hooks/use-settings.ts 23/23 (100.00%) 5.56% -1 💚
projects/packages/videopress/src/class-data.php 110/253 (43.48%) 9.61% -23 💚
projects/packages/videopress/src/class-videopress-rest-api-v1-settings.php 57/83 (68.67%) 33.61% -24 💚

Full summary · PHP report · JS report

obenland added 3 commits June 26, 2026 15:30
The settings form had two near-identical Card.Root/ToggleControl blocks.
Extract a local SettingCard component so each setting is a few props
instead of repeated card boilerplate.

Claude-Session: https://claude.ai/code/session_01K4JTgKPiD3XYk9CKb19Zoa
Rename videopress_auto_generated_captions_disabled to
videopress_auto_subtitles_disabled throughout, including the PHP getter,
REST param, TS hook fields, UI copy, comments, and changelog entries.

Claude-Session: https://claude.ai/code/session_01K4JTgKPiD3XYk9CKb19Zoa
Cover update_settings and get_settings for the VideoPress settings
endpoint, including the auto-subtitles option branches flagged as
uncovered by the coverage report.

Claude-Session: https://claude.ai/code/session_01K4JTgKPiD3XYk9CKb19Zoa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Sync [Package] VideoPress [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] Needs Review This PR is ready for review. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants