payloadcmsdirectory

payload wordpress

by payloadcmsdirectory
Import, export & migration
v3
^3.29.0

Overview

Summary generated from the README

Bridges WordPress MySQL databases and Payload through a plugin configured with a mode setting. It can run on PostgreSQL only, on the WordPress database only, on both with per-collection mapping, or in a migration mode with an admin panel for moving data from WordPress to PostgreSQL. Collections map to WordPress post types, fields to post meta, and users to WordPress user tables.

Features

  • Four modes: postgres-only, sql-only, both and migration
  • Per-collection and per-global database mapping in both mode
  • Admin UI panel that changes with the selected mode
  • Maps collections to wp_posts post types and fields to wp_postmeta
  • Maps Payload users to wp_users and wp_usermeta
  • Configurable WordPress table prefix and connection settings

Use cases

  • Migrate an existing WordPress site's content into Payload on PostgreSQL
  • Run Payload against a WordPress database while keeping some collections in PostgreSQL
  • Move posts, pages and users gradually from WordPress using the admin migration panel

From the author

WordPress database adapter and migration plugin for Payload CMS

Installation

npm i @launchthat.apps/payload-wordpress

5

Stars

1

Forks

0

Open Issues

1 years ago

Last Updated

0

Weekly Downloads

v

npm Version

Dependencies

GitHub stars

50 since Sep 6

Show data
GitHub stars by day (UTC)
DateStars
Dec 5, 20265
Dec 4, 20265
Dec 3, 20265
Dec 2, 20265
Dec 1, 20265
Nov 30, 20265
Nov 29, 20265
Nov 28, 20265
Nov 27, 20265
Nov 26, 20265
Nov 25, 20265
Nov 24, 20265
Nov 23, 20265
Nov 22, 20265
Nov 21, 20265
Nov 20, 20265
Nov 19, 20265
Nov 18, 20265
Nov 17, 20265
Nov 16, 20265
Nov 15, 20265
Nov 14, 20265
Nov 13, 20265
Nov 12, 20265
Nov 11, 20265
Nov 10, 20265
Nov 9, 20265
Nov 8, 20265
Nov 7, 20265
Nov 6, 20265
Nov 5, 20265
Nov 4, 20265
Nov 3, 20265
Nov 2, 20265
Nov 1, 20265
Oct 31, 20265
Oct 30, 20265
Oct 29, 20265
Oct 28, 20265
Oct 27, 20265
Oct 26, 20265
Oct 25, 20265
Oct 24, 20265
Oct 23, 20265
Oct 22, 20265
Oct 21, 20265
Oct 20, 20265
Oct 19, 20265
Oct 18, 20265
Oct 17, 20265
Oct 16, 20265
Oct 15, 20265
Oct 14, 20265
Oct 13, 20265
Oct 12, 20265
Oct 11, 20265
Oct 10, 20265
Oct 9, 20265
Oct 8, 20265
Oct 7, 20265
Oct 6, 20265
Oct 5, 20265
Oct 4, 20265
Oct 3, 20265
Oct 2, 20265
Oct 1, 20265
Sep 30, 20265
Sep 29, 20265
Sep 28, 20265
Sep 27, 20265
Sep 26, 20265
Sep 25, 20265
Sep 24, 20265
Sep 23, 20265
Sep 22, 20265
Sep 21, 20265
Sep 20, 20265
Sep 19, 20265
Sep 18, 20265
Sep 17, 20265
Sep 16, 20265
Sep 15, 20265
Sep 14, 20265
Sep 13, 20265
Sep 12, 20265
Sep 11, 20265
Sep 10, 20265
Sep 9, 20265
Sep 8, 20265
Sep 7, 20265
Sep 6, 20265
npm weekly downloads

Trends appear after 7 days of data. Daily snapshots have not started yet.

Each point is npm's rolling 7-day download count.

Health Score

13/100Poor

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/956042017-root.svg)](https://payloaddirectory.dev/plugins/956042017-root)
HTML
<a href="https://payloaddirectory.dev/plugins/956042017-root"><img src="https://payloaddirectory.dev/badge/956042017-root.svg" alt="Payload Directory"></a>
Updated Mar 27, 2025Created Mar 27, 2025

README

WordPress Database Adapter for PayloadCMS

This plugin provides a bridge between WordPress MySQL databases and PayloadCMS, allowing you to:

  1. Use PostgreSQL as your primary database (postgres-only mode)
  2. Use WordPress MySQL database as your primary database (sql-only mode)
  3. Use both databases simultaneously, defining which collections use which database (both mode)
  4. Migrate data from WordPress to PostgreSQL (migration mode)

Installation

npm install @launchthat.apps/payload-wordpress

# or with yarn
yarn add @launchthat.apps/payload-wordpress

# or with pnpm
pnpm add @launchthat.apps/payload-wordpress

Usage

import { wordpressPlugin } from "@launchthat.apps/payload-wordpress";
import { buildConfig } from "payload/config";

export default buildConfig({
  // Your Payload config
  collections: [
    // Your collections
  ],

  // Add the WordPress plugin
  plugins: [
    wordpressPlugin({
      mode: "postgres-only", // 'postgres-only', 'sql-only', 'both', or 'migration'

      // WordPress database configuration
      wordpressConfig: {
        host: process.env.WORDPRESS_DB_HOST || "localhost",
        user: process.env.WORDPRESS_DB_USER || "root",
        password: process.env.WORDPRESS_DB_PASSWORD || "",
        database: process.env.WORDPRESS_DB_NAME || "wordpress",
        port: parseInt(process.env.WORDPRESS_DB_PORT || "3306", 10),
        prefix: process.env.WORDPRESS_DB_PREFIX || "wp_",
      },

      // PostgreSQL configuration
      postgresConfig: {
        pool: {
          connectionString:
            process.env.DATABASE_URI ||
            "postgresql://postgres:postgres@localhost:5432/payload",
        },
      },

      // Only needed in 'both' mode to define which collections use which database
      collectionMapping: {
        posts: "wordpress",
        pages: "wordpress",
        users: "postgres",
        // ... other collections
      },

      // Only needed in 'both' mode to define which globals use which database
      globalMapping: {
        header: "postgres",
        footer: "postgres",
        // ... other globals
      },
    }),
  ],
});

Modes

PostgreSQL Only Mode

In this mode, the plugin behaves exactly like the native PostgreSQL adapter, using PostgreSQL for all collections and globals.

SQL Only Mode

In this mode, the plugin uses your WordPress MySQL database for all collections and globals, mapping Payload's data structure to WordPress tables.

Both Mode

In this mode, you can specify which collections and globals should use PostgreSQL and which should use the WordPress database.

Migration Mode

In this mode, both databases are connected, but the plugin provides a UI panel to migrate data from WordPress to PostgreSQL.

Admin UI Panels

The plugin automatically adds an admin UI panel based on your selected mode:

  • PostgreSQL Only Mode: Shows PostgreSQL database information
  • SQL Only Mode: Shows WordPress database information
  • Both Mode: Shows database mapping configuration
  • Migration Mode: Provides UI for migrating from WordPress to PostgreSQL

WordPress Database Mapping

When using the WordPress database, the plugin maps Payload's data model to WordPress tables:

  • Collections map to WordPress post types in wp_posts
  • Fields map to meta fields in wp_postmeta
  • Users map to WordPress users in wp_users and wp_usermeta

Development

Prerequisites

  • Node.js (>=18.20.2)
  • pnpm (>=9)

Building the Plugin

# Install dependencies
pnpm install

# Build the plugin
pnpm build

License

MIT

Similar plugins