This file provides guidance to AI coding agents when working with code in this repository.
Primary Reference: Social Plugin README.md - Plugin overview and setup
Related Packages:
- Publicize Package AGENTS.md - Core library documentation (most Social logic lives here)
- Automated Testing Overview - Testing patterns
- Coding Standards & Guidelines - Development best practices
Jetpack Social is a standalone WordPress plugin that enables automatic sharing of posts to social media networks. It is a thin orchestration layer — nearly all business logic lives in the Publicize package (projects/packages/publicize/).
Key characteristics:
- No JS build of its own — all frontend code comes from the Publicize package
- Bootstraps Jetpack packages via the Config pattern (
Automattic\Jetpack\Config) - Requires a WordPress.com connection to function (sharing happens server-side via WPCOM)
jetpack-social.php— Entry point: autoloader, constants, instantiatesJetpack_SocialJetpack_Social::__construct()— Sets up connection auth, registers hooks, initializes services- On
plugins_loaded(priority 1): Ensuresconnection,sync,identity_crisis, andpublicizepackages viaConfig - Publicize package is only loaded when the site has an active WordPress.com connection
The plugin delegates to these Jetpack packages:
publicize— Core sharing logic, REST API, block editor UIconnection— WordPress.com connection managementsync— Data synchronization with WPCOMmy-jetpack— Jetpack product management dashboard
Jetpack_Social(class-jetpack-social.php) — Main plugin class. Handles activation, module management, connection checks, and package configurationMeta_Tags(class-meta-tags.php) — Renders Open Graph and social meta tags inwp_headNote(class-note.php) — Social Notes custom post type (short-form social content)REST_Settings_Controller(class-rest-settings-controller.php) — Plugin-level REST settings endpointSocial_Shares(class-social-shares.php) — Share count tracking and[jp_shares_shortcode]shortcode
The plugin activates the publicize module via Automattic\Jetpack\Modules. On first activation, it sets an option flag (jetpack-social_activated) via add_option that triggers module activation on the next admin_init, then removes it with delete_option.
Jetpack_Social::is_connected() checks both site registration and user connection via Connection_Manager. The Publicize package is only configured when connected.
Jetpack_Social::has_paid_plan() uses Current_Plan::supports('social-shares-1000') to determine paid vs free tier.
jetpack test php plugins/social # Run PHPUnit tests
jetpack test php plugins/social -v # Verbose outputTest files are in tests/php/.
jetpack test e2e plugins/social # Run E2E tests (Playwright)E2E tests are in tests/e2e/. These test the full plugin flow including connection setup and sharing.