Search by

automattic / jetpack-my-jetpack

kraftjehervedereksmartautomattic

WP Admin page with information and configuration shared among all Jetpack stand-alone plugins

Package info

github.com/Automattic/jetpack-my-jetpack

Type:jetpack-library

pkg:composer/automattic/jetpack-my-jetpack

Statistics

Installs: 46 154

Dependents: 8

Suggesters: 0

Stars: 2

v6.15.0 2026-11-02 18:08 UTC

This package is auto-updated.

Last update: 2026-11-03 04:23:16 UTC


README

WP Admin page with information and configuration shared among all Jetpack stand-alone plugins

Overview

My Jetpack is a centralized WordPress admin page that provides a unified interface for managing all Jetpack products and services. It serves as the main dashboard where users can view, install, configure, and manage their Jetpack products.

Usage

Every Jetpack plugin must include the My Jetpack package.

Require this package and initialize it:

add_action( 'init', function() {
 Automattic\Jetpack\My_Jetpack\Initializer::init();
} );

Conditionally loading licensing UI behind a feature flag

To disable the licensing UI at /wp-admin/admin.php?page=my-jetpack#/add-license, add a filter on jetpack_my_jetpack_should_enable_add_license_screen and return false: add_filter( 'jetpack_my_jetpack_should_enable_add_license_screen', '__return_false' ); My Jetpack applies this filter automatically when initializing the offline Features entry described below.

Shared header controls

The my-jetpack-header-controls flag is on by default. My Jetpack and the modern Boost dashboard show an avatar and connection status control that opens connection and plan details. Controls stay hidden when My Jetpack is disabled or using offline Features, and dashboards must opt in to show them. On connected sites, Boost loads purchases only when the control is opened.

For rollback or testing, disable the controls with add_filter( 'jetpack_feature_flag_enabled_my-jetpack-header-controls', '__return_false' ); in a must-use plugin.

Managing features

With Jetpack active, users who can manage Jetpack modules can bulk activate or deactivate modules from the Features list even if they cannot activate plugins. Plugin rows in their batch fail individually with a permission message, without preventing permitted module changes.

While the Protect dashboard manages security modules, Features excludes them from bulk selection. Direct bulk module requests also refuse those entries with “Managed in Protect. Change these settings on the Protect page.” while processing other permitted modules; users without module-management permission receive the permission refusal instead. A request that also switches the Protect page off changes them once the page is off; while a host keeps the page on, they stay refused.

Where Features opens (sites registered with WordPress.com, and offline sites with the offline entry enabled), My Jetpack Features shows all eligible features by default, including unavailable modules and their reasons. Unavailable modules have no switch or bulk selection. Choose Available to exclude unavailable features, forced-off modules, and installed plugins forced inactive. Search spans all eligible features, and choosing a filter clears the search. Feature filters, search, layout, and an open feature remain in the URL across reloads.

Features automatically retries loading modules after a rate-limited or unreadable response. If loading fails and no modules are available, a visible notice says the list is incomplete. The notice asks for a page reload. A failed refresh leaves previously loaded modules visible without this notice.

Product status, Extras activation, and Hybrid activation and deactivation prefer an active copy when several declared copies are installed; with none active, they keep the first installed copy.

When a standalone plugin provides an alternative, its card retains the install or activation action and explains the Jetpack module's limitation. Except on the offline page, plan and connection restrictions retain applicable upgrade routes. Backup, Firewall, and Ads remain unavailable on multisite. Features hidden by the host stay hidden; forced and network-activated features retain their existing controls, with host reasons in the details window of main cards and below card descriptions; forced modules the site cannot run are listed as unavailable with their reasons.

Features let users connect their WordPress.com account from the cards that need one. The my-jetpack-account-connect flag is on by default. For rollback or testing, turn off the flag with add_filter( 'jetpack_feature_flag_enabled_my-jetpack-account-connect', '__return_false' );. Account connection from cards applies on a site registered with WordPress.com without a connected owner, for an administrator whose own account is not connected either, while the connection reports no errors. Those features, such as Activity Log, Newsletter, Social and Backup, wait for the account whether or not their plugin or Jetpack is installed, unless the host forces them off or multisite blocks them. A missing Social or Backup plugin, or a missing or inactive Jetpack, keeps Install or Activate, which turns the plugin on and then starts the account connection. An installed plugin or a module offers Connect instead of its switch, whether it is on or off: Connect starts the connection, and the return to Features turns the selected feature on once through its available switch, unless it is already on. Choosing Install Jetpack or Activate Jetpack from a module card also remembers that module and turns it on after setup if its switch is available and it is still off; modules already enabled by Jetpack's defaults stay on. If no account connection is needed, the module resumes after Jetpack reloads instead. On a site with Jetpack active, the resumed control can be Jetpack's module rather than the standalone plugin. Resuming requires this flag, does not run in offline mode, and requires a matching return or reload in the same browser tab within an hour of remembering the selection. The remembered selection is consumed on the first Features load; failed or cancelled setup, expired selections, and revisited return URLs cannot activate the feature later. The switch returns once the account is connected. Jetpack AI offers Connect only when the account is all it is missing: it stays without Connect on WordPress.com hosting, except in an Atomic internal testing environment, and when the AI module is missing. A feature already on keeps Deactivate in its details. Available and bulk actions leave these features out, and the connection return, or Jetpack's reload, comes back to the same Features view without its status filter. Available also leaves out features whose only action is an install the current user cannot make. A blocked install does not exclude a product that already runs without its plugin. Cards and their details omit Active and Inactive badges where the control already shows the state: a switch says whether the feature runs, Open opens a feature provided by a plan, and Install, Activate or Connect says what is missing. Unavailable stays with its reason. A feature that a host has forced on or off says so under its description. Jetpack AI, while its switch is hidden (on WordPress.com platform hosts, or with no connected owner), keeps Active or Inactive unless it needs an account. Any feature needing an account without an available Connect or Install action, including a blocked install, shows “Requires a connected WordPress.com account” on its card and in its details. Loading cards reserve no badge space, and details opened while modules load show no status badge. With the false override, the previous controls and badges return, Available again lists installs the user cannot make, and host reasons for main cards stay in their details windows.

The my-jetpack-modules-to-features flag is on by default, sending eligible legacy Modules links to Features through browser navigation, carrying saved searches and recognized module tags. To turn it off for rollback or testing, use add_filter( 'jetpack_feature_flag_enabled_my-jetpack-modules-to-features', '__return_false' );. Search and tag together narrow the results; Clear tag removes only the tag. These views include a Classic Modules list link that preserves the current search and tag and remains available if feature data fails to load. Purpose-group and active/inactive filters, unknown tags, and tags or saved searches matching only hidden features stay on Modules. Links reach Features only when My Jetpack detects Jetpack as installed and active, including Jetpack Beta with both jetpack/ and jetpack-dev/ installed and only Beta active. Features and Modules links prefer an active copy when several declared copies are installed; with none active, they keep the first installed copy. Must-use installations without an active plugin file retain Modules and their existing module controls. Sites or users without Features access, sites where My Jetpack would redirect to setup or a partner coupon screen, offline sites (even with the offline entry enabled), and disabled REST access retain Modules with the search and tag arguments preserved. Without JavaScript, legacy links and repointed management links also reach Modules; the server-printed fallback and its REST probe run only while the Modules-to-Features flag is enabled. The pinned footer and its Reset action remain available. Hosts that do not show My Jetpack can keep all management links on Modules with add_filter( 'jetpack_my_jetpack_modules_management_available', '__return_false' );.

Offline Mode

The offline Features entry is on by default. Visit /wp-admin/admin.php?page=my-jetpack#/features on a site in offline mode. My Jetpack opens Features without connection onboarding; other hash routes redirect there while preserving the query string. To turn it off for rollback or testing, register add_filter( 'jetpack_my_jetpack_offline_features', '__return_false' ); before My Jetpack initializes, for example in a must-use plugin.

Users need permission to edit posts and activate plugins, plus manage the network on multisite. The Jetpack plugin keeps its Modules and Settings entry for users who cannot access Features. Local modules can be switched and retain their state after reload. The Features controller refuses to activate modules that require a connection; standalone plugins can still be activated and may run their own activation steps, including Social enabling its module.

Features refuses to deactivate the plugin serving the page unless another active plugin will remain with My Jetpack 6.15.0 or later, which enables offline Features by default. The same restriction applies to bulk deactivation.

Feature details retain plan names and explanations as plain text offline, without purchase links or upgrade buttons. The offline page hides the footer.

The offline page skips product, ownership, notification, and history queries. The Jetpack plugin also suppresses its Scan toolbar notice and its signed status request, plus sidebar Scan and Rewind cache refreshes (including previously queued refreshes), in offline mode, whether or not offline Features is enabled. Other shared Jetpack code can still contact WordPress.com: the Search plan lookup with copied credentials and connected-user script data on a cold cache remain possible.

Architecture

Core Components

PHP Backend (src/)

  • Initializer (class-initializer.php): Main entry point that sets up admin menu, REST endpoints, and asset enqueuing
  • Products (class-products.php): Core product management system with status constants and lifecycle handling
  • Product Classes (src/products/): Individual product implementations inheriting from base Product class
  • REST API (class-rest-*.php): API endpoints for product management, purchases, and AI functionality

React Frontend (_inc/)

  • Main App (app.jsx): React Router setup, rendered by the wp-build route in routes/dashboard/
  • Onboarding (onboarding.jsx): Webpack entry for the full-screen onboarding takeover
  • Components (components/): Reusable UI components for product cards, screens, and interstitials
  • Data Layer (data/): Custom hooks and API integration using React Query (see Data Layer Documentation)
  • Context (context/): Global state management for notices and values

Product System

  • Products inherit from base Product class with standardized interface
  • Status constants define product lifecycle: active, inactive, needs_plan, plugin_absent, etc.
  • Hybrid products can function as both standalone plugins and Jetpack modules
  • Product cards dynamically display status, actions, and pricing information

Key Features

  • Connection Management: Handles WordPress.com site and user connections
  • Product Interstitials: Purchase/activation flows for each product
  • Onboarding Flow: Guided setup for new users
  • Licensing: License key management and validation
  • Activity Log: Integration with Jetpack activity monitoring
  • Speed Score: Boost performance metrics integration

Frontend Architecture

  • React 18 with functional components and hooks
  • React Router for client-side navigation
  • CSS Modules for component styling
  • TypeScript for type safety
  • Custom data hooks using React Query for API state management

Build System

  • Webpack with Jetpack-specific configuration
  • Babel for JavaScript transpilation
  • Sass for CSS preprocessing
  • Asset optimization for production builds
  • Textdomain replacement for internationalization

Development

Commands

Build Commands:

  • jetpack build packages/my-jetpack - Build from monorepo root
  • jetpack watch packages/my-jetpack - Watch mode from monorepo root
  • pnpm run build - Build from package directory
  • pnpm run test - Run tests from package directory

Testing Strategy

Testing:

  • PHP: PHPUnit with WordPress test environment and polyfills
  • JavaScript: Jest with React Testing Library
  • E2E: Integration with monorepo Playwright setup

Development Notes

Code Standards:

  • Uses WordPress coding standards and Jetpack extensions
  • Requires WordPress.com connection for full functionality
  • Integrates with Jetpack licensing and purchase systems
  • Supports feature flags for gradual rollouts
  • Compatible with WordPress multisite (when enabled)

API Endpoints

REST API Patterns

  • Base namespace: jetpack/v4/my-jetpack
  • Products endpoint: /products - main product data and actions
  • Purchases endpoint: /purchases - user purchase information
  • Feature endpoints: Various feature-specific endpoints

Data Flow

  1. React components call API via apiFetch
  2. WordPress routes to appropriate REST controller
  3. Controller validates permissions and processes request
  4. Product classes handle business logic
  5. Response returned to frontend for UI updates

Key Files Reference

PHP Files

  • src/class-initializer.php - Main initialization, admin menu setup
  • src/class-products.php - Core product management, status constants
  • src/products/class-product.php - Base product class
  • src/class-rest-products.php - Main products API endpoint
  • src/class-wpcom-products.php - WordPress.com product integration

React Files

  • _inc/app.jsx - Main React application, rendered by routes/dashboard/stage.tsx
  • _inc/onboarding.jsx - Onboarding takeover entry point
  • _inc/providers.tsx - Context providers wrapper
  • _inc/constants.ts - Route definitions and constants
  • _inc/components/my-jetpack-screen/ - Main dashboard screen
  • _inc/components/product-interstitial/ - Product setup flows
  • _inc/data/ - API hooks and data management using React Query

Configuration Files

  • package.json - Dependencies and scripts
  • webpack.config.js - Build configuration
  • babel.config.js - JavaScript transpilation
  • tsconfig.json - TypeScript configuration

Using this package in your WordPress plugin

If you plan on using this package in your WordPress plugin, we would recommend that you use Jetpack Autoloader as your autoloader. This will allow for maximum interoperability with other plugins that use this package as well.

Security

Need to report a security vulnerability? Go to https://automattic.com/security/ or directly to our security bug bounty site https://hackerone.com/automattic.

License

my-jetpack is licensed under GNU General Public License v2 (or later)