Skip to content

Conversation

coder-karen
Copy link
Contributor

@coder-karen coder-karen commented Oct 8, 2025

Fixes VULCAN-309

Proposed changes:

  • This PR ensures that if a theme adds theme support for Jetpack testimonials or portfolios (with add_theme_support( 'jetpack-testimonial') for example), the feature behaves as if it is available, as well as enabled, preventing issues on block themes when disabling the feature. It also ensures that if post types are not registered, we don't attempt to continue with testimonial or portfolio setup steps.
  • The PR also prevents some warnings related to the orderby array key being undefined in some cases.

In more detail:

  • If a block theme attempts to force-enable Jetpack testimonials or portfolios with the add_theme_support method, this had two side effects.
    • The first was that due to load variations, WoA sites in particular could briefly end up in a position where the post type is not yet registered, yet testimonial code was running that expected the post type to be registered. This was partially mitigated in Testimonials: Prevent PHP warning if CPT does not exist #45388 (warnings prevented), and a further check is added to this PR to ensure we don't continue if the post type is not registered.
    • The second was that for those block-themed sites who have force-enabled testimonials or portfolios, if a user then disables either post type via the Jetpack settings UI they will disappear and it won't be possible to make them available again (unless re-enabling them with a filter, or deactivating / reactivating the theme).
      • This excludes WoA sites, who disable the ability to change the toggle state (example)

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

p1759778364516359-slack-C05PV073SG3

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

No.

Testing instructions:

  • On a self-hosted test site, add a non-block theme that adds theme support for testimonials and or portfolios - Dara is an example (testimonials). Others include Lodestar (both), Sketch (portfolios).
  • Observe the expected behaviour - when visiting Jetpack > Settings > Writing you will see both testimonials and portfolios available, with the relevant toggle (or toggles) enabled. Toggling them off does not remove that feature.
  • Then add a block theme that also adds theme support, an example being Organic Chrono or Stax (to test this, see this Slack thread - p1759778364516359-slack-C05PV073SG3 )
  • Notice that both will be enabled. Try disabling either or both - they should disappear from the settings page.
  • The above testing assumes you have no testimonials or portfolios added on the site.

To replicate the 'orderby' warnings:

  • On a site with testimonials or portfolios active, and several instances of either, create a post and add a testimonials or portfolios shortcode, with an incorrect 'orderby' value. For example [jetpack_testimonials orderby="modified"].
  • Open up the post, and notice the 'Undefined array key' warning in your logs

To test the fix:

  • Apply this PR, and follow the same steps with the block theme that adds theme support. When disabling the features, they should remain available.
  • As for the 'Undefined array key' warnings, follow the same steps under 'to replicate the 'orderby' warnings, however in this case you should not see any warnings. The default ordering of the testimonials / portfolios on the post should remain the same.

Ensure that on WoA / Simple sites, the theme activation / deactivation flow with different themes adding support is as expected as well. On Simple, Settings > Writing is where you'll find the toggles.

@coder-karen coder-karen self-assigned this Oct 8, 2025
@coder-karen coder-karen added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] Custom Content Types Custom post or content types (usually for testimonials and portfolios) and their settings. [Status] In Progress [Package] Classic Theme Helper labels Oct 8, 2025
Copy link
Contributor

github-actions bot commented Oct 8, 2025

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 update/testimonials-portfolios-force-enable-functionality branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/testimonials-portfolios-force-enable-functionality
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/testimonials-portfolios-force-enable-functionality

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 [Feature] Theme Tools [Plugin] Classic Theme Helper Plugin [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Wpcomsh labels Oct 8, 2025
Copy link
Contributor

github-actions bot commented Oct 8, 2025

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 a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ 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:

No scheduled milestone found for this plugin.

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


Mu Wpcom plugin:

  • Next scheduled release: WordPress.com Simple releases happen semi-continuously (PCYsg-Jjm-p2)

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


Wpcomsh plugin:

  • Next scheduled release: Atomic deploys happen twice daily on weekdays (p9o2xV-2EN-p2)

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


Classic Theme helper plugin plugin:

No scheduled milestone found for this plugin.

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

Copy link

jp-launch-control bot commented Oct 8, 2025

Code Coverage Summary

Coverage changed in 2 files.

File Coverage Δ% Δ Uncovered
projects/packages/classic-theme-helper/src/custom-post-types/class-jetpack-portfolio.php 0/580 (0.00%) 0.00% 5 💔
projects/packages/classic-theme-helper/src/custom-post-types/class-jetpack-testimonial.php 0/417 (0.00%) 0.00% 5 💔

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

@coder-karen coder-karen marked this pull request as ready for review October 8, 2025 11:24
@coder-karen coder-karen added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Oct 8, 2025
@coder-karen coder-karen requested review from a team and tbradsha October 8, 2025 12:39
Copy link
Contributor

@bindlegirl bindlegirl left a comment

Choose a reason for hiding this comment

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

Tested 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Custom Content Types Custom post or content types (usually for testimonials and portfolios) and their settings. [Feature] Theme Tools [Package] Classic Theme Helper [Plugin] Classic Theme Helper Plugin [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Wpcomsh [Status] Needs Review This PR is ready for review. [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants