ForgeWP

The Companion Plugin

What the generated <slug>-companion plugin contains, when to install it next to the theme, and how it keeps content types, REST endpoints, forms, sign-in and settings working when you switch themes or run decoupled.

Every forgewp export produces two packages from the same project:

Table · 3 columns
Package
Location
Contains
Theme
.forgewp/<slug>.zip
Templates, styles, assets, interactive islands, block rendering, page provisioning
Companion Plugin
.forgewp/<slug>-companion.zip
Content types and fields, the forgewp/v1 REST endpoints, Native Forms, sign-in endpoints, WooCommerce endpoints, Theme Options, site settings, menu and theme-mod storage, redirects, and your src/server/plugin/*.php

The plugin holds everything your site's data and API depend on. The theme holds how the site looks. Keeping them apart means your content, form submissions, settings and API keep working when the theme changes.

Do I need to install it?

The theme already contains a copy of the backend and uses it whenever the Companion Plugin is not active, so a site that only ever runs your ForgeWP theme works with the theme ZIP alone.

Table · 2 columns
Your site
Install
Native WordPress, always with your ForgeWP theme
Theme ZIP. The Companion Plugin is optional.
Decoupled (Next.js frontend reading WordPress)
Companion Plugin. The theme is optional on the WordPress side.
You may switch themes later, or run Hybrid
Both.

When both are active, the plugin's backend is used and the theme's copy is skipped, because WordPress loads plugins before themes. Install both from the same export: if their versions differ, wp-admin shows a notice asking you to reinstall them together.

Install

  1. In wp-admin, open Plugins → Add New → Upload Plugin.
  2. Select .forgewp/<slug>-companion.zip, then Install Now and Activate.

With WP-CLI:

Terminal
wp plugin install /path/to/<slug>-companion.zip --activate

For a decoupled site, keep the plugin active on the WordPress install your Next.js app reads from (FORGEWP_WP_URL).

What survives a theme switch

With the Companion Plugin active, switching to another theme (including a default WordPress theme) keeps:

  • custom post types, taxonomies and registered fields;
  • all forgewp/v1 endpoints (routes, menus, site-settings, forms, sign-in, WooCommerce);
  • Native Forms: submissions, the wp-admin inbox, email notifications;
  • Theme Options values and declared site options;
  • menu locations, the custom logo and declared theme mods. ForgeWP stores these independently of the active theme, so they also survive WordPress's own menu-location remapping on theme switches;
  • redirects declared in wp.config.ts.

Page templates, styling and islands belong to the theme and change with it.

Deactivating or removing the plugin

  • Deactivate while your ForgeWP theme is active: the theme's built-in backend takes over immediately. Content, submissions, settings and menus are unaffected.
  • Delete: the plugin does not delete any data. Posts, submissions and options stay in the database.

Updating

Re-export the project and install the new theme and plugin ZIPs together. Both carry the version from wp.config.ts.

Your own backend PHP

Put PHP that must keep working regardless of the active theme in src/server/plugin/. It ships in the Companion Plugin (and in the theme's built-in backend). See Custom PHP with src/server/.