### Install WordPress Plugin or Theme (WP-CLI) Source: https://developer.wordpress.com/docs/developer-tools/wp-cli/common-commands Installs a plugin or theme from the WordPress.org repository using its slug, or from a URL pointing to a .zip installation file. The --force flag can be used to overwrite existing installations, and --activate can be used to activate the item immediately after installation. ```bash wp plugin/theme install {SLUG or URL TO INSTALLATION_FILE} ``` ```bash wp plugin/theme install {SLUG} --force ``` ```bash wp plugin/theme install {SLUG} --activate ``` -------------------------------- ### GET /checkout/{site_domain}/{product_slugs} Source: https://developer.wordpress.com/docs/payment-checkout-links Initiates a checkout flow for an existing site. ```APIDOC ## GET /checkout/{site_domain}/{product_slugs} ### Description Initiates a checkout flow for products to be applied to an existing site. ### Method GET ### Endpoint https://wordpress.com/checkout/{site_domain}/{product_slugs} ### Parameters #### Path Parameters - **site_domain** (string) - Required - The domain of the existing site. - **product_slugs** (string) - Required - Comma-separated list of product slugs. ### Request Example https://wordpress.com/checkout/example.com/premium ### Response Redirects the user to the checkout page for the specified site. ``` -------------------------------- ### GET /checkout/unified/{product_slugs} Source: https://developer.wordpress.com/docs/payment-checkout-links Initiates a unified checkout flow for new purchases, handling account and site creation automatically. ```APIDOC ## GET /checkout/unified/{product_slugs} ### Description Initiates a unified checkout flow for new purchases. If the user is logged out, they are prompted to authenticate. If no site exists, one is created during the process. ### Method GET ### Endpoint https://wordpress.com/checkout/unified/{product_slugs} ### Parameters #### Path Parameters - **product_slugs** (string) - Required - Comma-separated list of product slugs. Supports metadata (e.g., :example.com) and quantities (e.g., :-q-5). ### Request Example https://wordpress.com/checkout/unified/personal,dotcom_domain:example.com ### Response Redirects the user to the WordPress.com checkout interface. ``` -------------------------------- ### GET /checkout/unified/{products} Source: https://developer.wordpress.com/docs/payment-checkout-links Initiates a unified checkout process for new or existing users, allowing for multiple product purchases. ```APIDOC ## GET /checkout/unified/{products} ### Description Initiates the checkout process. This endpoint handles account creation if the user is logged out and supports multiple products separated by commas. ### Method GET ### Endpoint /checkout/unified/{products} ### Parameters #### Path Parameters - **products** (string) - Required - A comma-separated list of product slugs (e.g., 'personal', 'premium,dotcom_domain:myblog.com'). ### Request Example https://wordpress.com/checkout/unified/business,domain_reg:mybusiness.com,wp_google_workspace_business_starter_yearly:mybusiness.com:-q-5 ### Response #### Success Response (302) Redirects the user to the WordPress.com checkout flow with the specified cart items. ``` -------------------------------- ### Constructing Unified Checkout URLs Source: https://developer.wordpress.com/docs/payment-checkout-links Demonstrates how to build URLs for the unified checkout process, including examples for purchasing different plans, adding domains, and including add-ons like Google Workspace with quantity specifications. ```url https://wordpress.com/checkout/unified/personal ``` ```url https://wordpress.com/checkout/unified/premium,dotcom_domain:myblog.com ``` ```url https://wordpress.com/checkout/unified/business,domain_reg:mybusiness.com,wp_google_workspace_business_starter_yearly:mybusiness.com:-q-5 ``` ```url https://wordpress.com/checkout/mysite.wordpress.com/jetpack_ai_yearly:-q-500 ``` -------------------------------- ### GET /checkout/{site_slug}/{products} Source: https://developer.wordpress.com/docs/payment-checkout-links Initiates a checkout process specifically tied to an existing site or domain. ```APIDOC ## GET /checkout/{site_slug}/{products} ### Description Used for purchases tied to an existing site. The site slug can be a WordPress.com subdomain or a custom domain. ### Method GET ### Endpoint /checkout/{site_slug}/{products} ### Parameters #### Path Parameters - **site_slug** (string) - Required - The identifier for the site (e.g., 'mysite.wordpress.com'). - **products** (string) - Required - Comma-separated product slugs, optionally including quantity suffixes (e.g., 'jetpack_ai_yearly:-q-500'). ### Request Example https://wordpress.com/checkout/mysite.wordpress.com/jetpack_ai_yearly:-q-500 ### Response #### Success Response (302) Redirects the user to the checkout flow for the specified site. ``` -------------------------------- ### Adding Email Products with Quantity Source: https://developer.wordpress.com/docs/payment-checkout-links Example of constructing a checkout URL for Google Workspace products that require both domain metadata and seat quantity. ```text https://wordpress.com/checkout/unified/wp_google_workspace_business_starter_yearly:example.com:-q-5 ``` -------------------------------- ### GET /oembed/ Source: https://developer.wordpress.com/docs/guides/oembed-provider-api Retrieves the oEmbed representation of a specific URL in either JSON or XML format. ```APIDOC ## GET /oembed/ ### Description Retrieves the oEmbed representation of a given URL. This endpoint is used by third-party sites to discover content metadata for embedding purposes. ### Method GET ### Endpoint http://public-api.wordpress.com/oembed/ ### Parameters #### Query Parameters - **format** (string) - Required - The response format, either 'json' or 'xml'. - **url** (string) - Required - The URL of the WordPress post, page, or attachment. - **for** (string) - Optional - Identifier for the discovery source, typically 'wpcom-auto-discovery'. ### Request Example GET http://public-api.wordpress.com/oembed/?format=json&url=http://tekartist.org/2011/07/13/yourself-truly-by-emma/&for=wpcom-auto-discovery ### Response #### Success Response (200) - **type** (string) - The type of oEmbed resource (e.g., 'rich', 'link'). - **version** (string) - The oEmbed version. - **title** (string) - The title of the content. #### Response Example { "version": "1.0", "type": "rich", "title": "Yourself Truly by Emma", "url": "http://tekartist.org/2011/07/13/yourself-truly-by-emma/" } ``` -------------------------------- ### GET /oembed/ Source: https://developer.wordpress.com/docs/guides/oembed-provider-api Retrieves oEmbed data for a specific URL, providing metadata and HTML for embedding content. ```APIDOC ## GET /oembed/ ### Description Fetches oEmbed data for a given URL, returning information like the provider name, author, title, and the HTML snippet required to embed the content. ### Method GET ### Endpoint https://public-api.wordpress.com/oembed/ ### Parameters #### Query Parameters - **for** (string) - Required - The domain or identifier for the request. - **url** (string) - Required - The URL of the WordPress content to be embedded. - **as_article** (boolean) - Optional - If set to true, returns the content in article mode. ### Request Example GET https://public-api.wordpress.com/oembed/?for=develop.wordpress.com&url=https://wordpress.com/blog/2025/06/13/wordcamp-europe-2025-recap/ ### Response #### Success Response (200) - **version** (string) - The oEmbed version. - **provider_name** (string) - The name of the provider. - **author_name** (string) - The name of the content author. - **title** (string) - The title of the embedded content. - **html** (string) - The HTML code for embedding the content. - **type** (string) - The type of the embed (e.g., "rich"). #### Response Example { "version": "1.0", "provider_name": "WordPress.com News", "author_name": "Nick Schäferhoff", "title": "WordCamp Europe 2025 Recap", "html": "
...", "type": "rich" } ``` -------------------------------- ### Minimal WordPress Blueprint Configuration (JSON) Source: https://developer.wordpress.com/docs/guides/how-to-create-custom-blueprints This minimal Blueprint configures preferred WordPress and PHP versions, installs and activates the WooCommerce plugin and the Pendant theme, and sets the admin color scheme. It utilizes a JSON schema for standardization across WordPress Playground and Studio. ```json { "$schema": "https://playground.wordpress.net/blueprint-schema.json", "landingPage": "/wp-admin/", "login": true, "preferredVersions": { "php": "8.3", "wp": "latest" }, "steps": [ { "step": "installPlugin", "pluginData": { "resource": "wordpress.org/plugins", "slug": "woocommerce" }, "options": { "activate": true } }, { "step": "installTheme", "themeData": { "resource": "wordpress.org/themes", "slug": "pendant" }, "options": { "activate": true } }, { "step": "updateUserMeta", "meta": { "admin_color": "modern" }, "userId": 1 } ] } ``` -------------------------------- ### Update All WordPress Plugins/Themes (WP-CLI) Source: https://developer.wordpress.com/docs/developer-tools/wp-cli/common-commands Updates all installed plugins and themes on the site if updates are available. This command simplifies the process of keeping the site's components up-to-date. ```bash wp plugin/theme update --all ``` -------------------------------- ### GET /checkout/renew/{subscription_id} Source: https://developer.wordpress.com/docs/payment-checkout-links Initiates the renewal process for an existing subscription. ```APIDOC ## GET /checkout/renew/{subscription_id} ### Description Self-contained renewal URL. The system automatically resolves the product, site, and billing details based on the subscription ID. ### Method GET ### Endpoint /checkout/renew/{subscription_id} ### Parameters #### Path Parameters - **subscription_id** (integer) - Required - The unique ID of the subscription to renew. ### Request Example https://wordpress.com/checkout/renew/98765 ### Response #### Success Response (302) Redirects the user to the renewal payment page. ``` -------------------------------- ### GET /checkout/renew/{subscription_id} Source: https://developer.wordpress.com/docs/payment-checkout-links Directs the user to the renewal page for an existing subscription. ```APIDOC ## GET /checkout/renew/{subscription_id} ### Description Directs the user to the renewal flow for a specific subscription using its internal Store ID. ### Method GET ### Endpoint https://wordpress.com/checkout/renew/{subscription_id} ### Parameters #### Path Parameters - **subscription_id** (integer) - Required - The internal Store subscription ID. ### Request Example https://wordpress.com/checkout/renew/12345 ### Response Redirects the user to the renewal checkout page. ``` -------------------------------- ### GET /oembed Source: https://developer.wordpress.com/docs/guides/oembed-provider-api Retrieves oEmbed data for a specific WordPress URL, supporting optional parameters for image sizing and response format. ```APIDOC ## GET /oembed ### Description Fetches metadata for a WordPress post URL using the oEmbed standard. ### Method GET ### Endpoint https://public-api.wordpress.com/oembed/ ### Parameters #### Query Parameters - **for** (string) - Required - The site identifier requesting the oEmbed data. - **url** (string) - Required - The URL of the WordPress post to retrieve. - **as_article** (boolean) - Optional - Whether to return the content as an article type. - **img_size** (string) - Optional - Requested dimensions for the thumbnail (e.g., 880x660). - **format** (string) - Optional - The response format, either 'json' or 'xml'. ### Request Example GET https://public-api.wordpress.com/oembed/?for=develop.wordpress.com&url=https://wordpress.com/blog/2025/06/13/wordcamp-europe-2025/&format=json ### Response #### Success Response (200) - **version** (string) - The oEmbed version. - **provider_name** (string) - The name of the provider. - **title** (string) - The title of the post. - **thumbnail_url** (string) - The URL of the post thumbnail. #### Response Example { "version": "1.0", "provider_name": "WordPress.com News", "title": "WordCamp Europe 2025 Recap", "type": "article" } ``` -------------------------------- ### Retrieve oEmbed Data via HTTP GET Source: https://developer.wordpress.com/docs/guides/oembed-provider-api This snippet demonstrates the basic structure of an oEmbed API request to WordPress. It requires the 'for' and 'url' parameters to return a JSON object containing metadata and embed HTML. ```http https://public-api.wordpress.com/oembed/?for=develop.wordpress.com&url=https://wordpress.com/blog/2025/06/13/wordcamp-europe-2025-recap-connecting-and-learning-in-basel-switzerland/ ``` -------------------------------- ### Formatting Product Slugs with Metadata and Quantity Source: https://developer.wordpress.com/docs/payment-checkout-links Demonstrates how to append metadata and quantity modifiers to product slugs using colon separators and the :-q- syntax. ```text https://wordpress.com/checkout/unified/personal https://wordpress.com/checkout/unified/premium,domain_reg:example.com dotlive_domain:example.live domain_reg:example.com ak_personal_yearly:-q-20 wp_google_workspace_business_starter_yearly:example.com:-q-12 {product_slug}:{meta}:-q-{quantity} ``` -------------------------------- ### Skip Plugins During WP-CLI Execution Source: https://developer.wordpress.com/docs/developer-tools/wp-cli/common-commands Demonstrates how to execute WP-CLI commands while excluding specific plugins to troubleshoot conflicts. This is useful for isolating issues caused by third-party extensions. ```bash wp --skip-plugins=woocommerce,code-snippets,elementor-pro plugin list ``` -------------------------------- ### Create New WordPress User (WP-CLI) Source: https://developer.wordpress.com/docs/developer-tools/wp-cli/common-commands Creates a new local user on the WordPress site, requiring a name, email address, and role. Note that this command does not create a corresponding WordPress.com user for SSO purposes. ```bash wp user create {NAME} {USER EMAIL} --role={ROLE} ``` -------------------------------- ### Manage Site Options with WP-CLI Source: https://developer.wordpress.com/docs/developer-tools/wp-cli/common-commands Commands for retrieving, updating, adding, and deleting site options. These commands interact with the WordPress options table, which is critical for site functionality. Incorrect usage can lead to site instability or failure. ```bash wp option get {OPTION} wp option update {OPTION} {VALUE} wp option add {OPTION} {VALUE} wp option delete {OPTION} ``` -------------------------------- ### Manage Content Source: https://developer.wordpress.com/docs/developer-tools/wp-cli/common-commands Commands to list, update, and delete site posts. ```APIDOC ## CLI command: wp post ### Description Perform CRUD operations on site posts. ### Method CLI ### Parameters #### Path Parameters - **action** (string) - Required - One of: list, update, delete, exists - **post_id** (integer) - Optional - The ID of the post #### Query Parameters - **post_type** (string) - Optional - Filter by post type (e.g., posts, pages) - **format** (string) - Optional - Output format ### Request Example wp post delete 123 ### Response Success message confirming post deletion. ``` -------------------------------- ### Managing Plugins with wpcomsh Source: https://developer.wordpress.com/docs/developer-tools/wp-cli/common-commands Commands to manage plugin states, including deactivating, reactivating, and switching between managed and unmanaged versions. ```APIDOC ## wpcomsh Plugin Management ### Description Commands to manage plugin states, including deactivating, reactivating, and switching between managed and unmanaged versions. ### Method WP-CLI Command ### Endpoint N/A ### Parameters #### Path Parameters - **{SLUG}** (string) - Required - The slug of the plugin to manage. - **{DATA}** (string) - Required - The type of persistent data to retrieve. #### Query Parameters - **--interactive** (boolean) - Optional - Forces confirmation for each plugin action. - **--remove-existing** (boolean) - Optional - Skips the confirmation step when switching plugin versions. - **--version={X.Y.Z}** (string) - Optional - Defines the specific version to install for unmanaged plugins. ### Available Commands - `wp wpcomsh deactivate-user-plugins` - `wp wpcomsh reactivate-user-plugins` - `wp wpcomsh plugin use-managed {SLUG}` - `wp wpcomsh plugin use-unmanaged {SLUG}` - `wp wpcomsh persistent-data {DATA}` ### Request Example (Use Managed Plugin) ``` wp wpcomsh plugin use-managed amp ``` ### Request Example (Use Unmanaged Plugin with Version) ``` wp wpcomsh plugin use-unmanaged gutenberg --version=10.0.0 ``` ### Response #### Success Response (200) - **message** (string) - Confirmation of the action performed. #### Response Example ```json { "message": "Plugin 'amp' is now using a managed version." } ``` ``` -------------------------------- ### Empty Site Content with WP-CLI Source: https://developer.wordpress.com/docs/developer-tools/wp-cli/common-commands Commands to irreversibly remove all posts and pages, or additionally remove all media files from a site. These operations require the '--yes' flag for confirmation and should only be used after ensuring a reliable backup is available. ```bash wp site empty --yes wp site empty --uploads --yes ``` -------------------------------- ### Manage Site Content (Posts) with WP-CLI Source: https://developer.wordpress.com/docs/developer-tools/wp-cli/common-commands Commands for listing, updating, deleting, and checking the existence of posts. Supports filtering by post type and formatting output. Use with caution, especially delete commands, as they are irreversible. ```bash wp post list wp post list --post_type=posts,pages --format=count wp post update {POST_ID} --{KEY}={VALUE} wp post update123 --post_status=draft wp post delete {POST_ID} wp post exists {POST_ID} ``` -------------------------------- ### Managing Themes with wpcomsh Source: https://developer.wordpress.com/docs/developer-tools/wp-cli/common-commands Commands to manage theme states, including switching between managed and unmanaged versions. ```APIDOC ## wpcomsh Theme Management ### Description Commands to manage theme states, including switching between managed and unmanaged versions. ### Method WP-CLI Command ### Endpoint N/A ### Parameters #### Path Parameters - **{SLUG}** (string) - Required - The slug of the theme to manage. #### Query Parameters - **--remove-existing** (boolean) - Optional - Skips the confirmation step when switching theme versions. - **--version={X.Y.Z}** (string) - Optional - Defines the specific version to install for unmanaged themes. ### Available Commands - `wp wpcomsh theme use-managed {SLUG}` - `wp wpcomsh theme use-unmanaged {SLUG}` ### Request Example (Use Managed Theme) ``` wp wpcomsh theme use-managed storefront ``` ### Request Example (Use Unmanaged Theme with Version) ``` wp wpcomsh theme use-unmanaged twentytwentytwo --version=1.2 ``` ### Response #### Success Response (200) - **message** (string) - Confirmation of the action performed. #### Response Example ```json { "message": "Theme 'storefront' is now using a managed version." } ``` ``` -------------------------------- ### Jetpack AI Product Slugs with Quantity Suffix Source: https://developer.wordpress.com/docs/payment-checkout-links Details the product slugs for Jetpack AI, demonstrating how the ':-q-{n}' suffix is used to specify the request tier for yearly, monthly, and bi-yearly plans. This allows for volume-based pricing. ```text jetpack_ai_yearly:-q-100 jetpack_ai_yearly:-q-200 jetpack_ai_yearly:-q-500 jetpack_ai_yearly:-q-750 jetpack_ai_yearly:-q-1000 jetpack_ai_monthly:-q-100 jetpack_ai_bi_yearly:-q-100 ``` -------------------------------- ### Constructing Base Checkout URLs Source: https://developer.wordpress.com/docs/payment-checkout-links These URL patterns are used to initiate the checkout process for new purchases, existing site upgrades, or subscription renewals. ```text https://wordpress.com/checkout/unified/{product_slugs} https://wordpress.com/checkout/renew/{subscription_id} https://wordpress.com/checkout/{site_domain}/{product_slugs} ``` -------------------------------- ### View User Capabilities with WP-CLI Source: https://developer.wordpress.com/docs/guides/manage-permissions This command allows you to view the capabilities assigned to a specific user. It helps in diagnosing permission issues by showing the exact permissions the user has. ```bash wp user list-caps {userID} ``` -------------------------------- ### Regenerate Media Thumbnails with WP-CLI Source: https://developer.wordpress.com/docs/developer-tools/wp-cli/common-commands Command to regenerate media thumbnails, particularly useful when the Jetpack Photon module is deactivated. The '--only-missing' flag can be used to optimize the process by skipping already existing image sizes. ```bash wp media regenerate wp media regenerate --only-missing ``` -------------------------------- ### Configure HTTP Headers via custom-redirects.php Source: https://developer.wordpress.com/docs/guides/add-http-headers This PHP snippet demonstrates how to set security-related HTTP headers using the header() function. It should be placed in a custom-redirects.php file in the site's root directory to apply headers to server responses. ```php
Example Post Title", "width": 600, "height": 330 } ``` #### Response Example (as_article=true) ```json { "type": "article", "version": "1.0", "title": "Example Post Title", "author_url": "https://example.wordpress.com", "author_name": "Example Author", "provider_url": "https://wordpress.com", "provider_name": "WordPress.com", "thumbnail_url": "https://example.wordpress.com/wp-content/uploads/2023/10/thumbnail.jpg", "thumbnail_width": 440, "thumbnail_height": 330, "body": "This is a short excerpt of the article content...", "width": 600, "height": 330, "geo_latitude": 34.0522, "geo_longitude": -118.2437, "related_topics": ["topic1", "topic2"] } ``` ``` -------------------------------- ### Reset Role Permissions with WP-CLI Source: https://developer.wordpress.com/docs/guides/manage-permissions Use this command to reset a role's permissions to their default settings. This is useful when default permissions have been altered or corrupted, affecting all users assigned to that role. ```bash wp role reset editor ``` -------------------------------- ### WordPress oEmbed JSON Response Structure Source: https://developer.wordpress.com/docs/guides/oembed-provider-api This represents the standard JSON response returned by the WordPress oEmbed endpoint. It includes fields such as version, provider information, and a script-enhanced HTML block for rendering the embed. ```json { "version": "1.0", "provider_name": "WordPress.com News", "provider_url": "http://en.blog.wordpress.com", "author_name": "Nick Schäferhoff", "author_url": "https://en.blog.wordpress.com/author/nschaeferhoff/", "title": "WordCamp Europe 2025 Recap: Connecting and Learning in Basel, Switzerland", "html": "
WordCamp Europe 2025 Recap: Connecting and Learning in Basel, Switzerland", "type": "rich", "thumbnail_url": "https://en-blog.files.wordpress.com/2025/06/wceu-2025-recap-header.jpg?fit=440%2C330", "thumbnail_width": null, "thumbnail_height": null } ``` -------------------------------- ### Disable All Non-User Block Patterns Source: https://developer.wordpress.com/docs/guides/block-patterns This snippet disables remote patterns from the Dotorg directory and unregisters existing core, Dotcom, and plugin-provided patterns by hooking into the REST API dispatch process. ```php add_filter( 'should_load_remote_block_patterns', '__return_false' ); add_filter( 'rest_dispatch_request', 'your_theme_restrict_block_editor_patterns', 12, 3 ); function your_theme_restrict_block_editor_patterns( $dispatch_result, $request, $route ) { if ( strpos( $route, '/wp/v2/block-patterns/patterns' ) === 0 ) { $patterns = WP_Block_Patterns_Registry::get_instance()->get_all_registered(); if ( ! empty( $patterns ) ) { foreach ( $patterns as $pattern ) { unregister_block_pattern( $pattern['name'] ); } remove_theme_support( 'core-block-patterns' ); } } return $dispatch_result; } ``` -------------------------------- ### Disable WordPress.com Specific Patterns Source: https://developer.wordpress.com/docs/guides/block-patterns This snippet restricts the loading of patterns specifically from the WordPress.com library by overriding the source site filter. ```php add_filter( 'a8c_override_patterns_source_site', 'your_theme_restrict_block_editor_patterns_from_dotcom_library' ); function your_theme_restrict_block_editor_patterns_from_dotcom_library() { return 'disable-dotcom-patterns-source'; } ``` -------------------------------- ### Delete a Custom Role with WP-CLI Source: https://developer.wordpress.com/docs/guides/manage-permissions This command removes a custom user role from your WordPress site. It's typically used when a plugin that created the role has been uninstalled, leaving behind unused roles. ```bash wp role delete editor ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.