Skip to content
/ wp-md Public

Create & edit remote WordPress content as markdown files locally.

Notifications You must be signed in to change notification settings

tomtev/wp-md

Repository files navigation

wp-md

╦ ╦╔═╗   ╔╦╗╔╦╗
║║║╠═╝───║║║ ║║
╚╩╝╩     ╩ ╩═╩╝

Create & edit remote WordPress content as markdown files locally.

Turn your WordPress site into a local folder of markdown files. Edit pages, posts, patterns, templates, and WooCommerce products with your favorite editor or AI coding assistant and sync back to remote site with changes.

Quick Start

# Install
curl -fsSL https://raw.githubusercontent.com/tomtev/wp-md/main/install.sh | bash

# Go to your project folder (where you want the markdown files)
cd your-project

# Connect to your WordPress site
wp-md init

# Pull all content from WordPress
wp-md pull

# Edit files locally, then push changes back
wp-md push

Requirements

Commands

Command Description
wp-md init [folder] Configure WordPress connection
wp-md pull Download content from WordPress
wp-md push Upload local changes to WordPress
wp-md status Show sync status
wp-md watch Watch for changes and auto-sync
wp-md new <type> <title> Create new content
wp-md upload <file> Upload media file
wp-md force-push Push all content (creates missing)

All commands support -d, --dir <directory> to specify a content directory.

Watch Options

wp-md watch              # Watch current directory
wp-md watch -d site-a    # Watch specific site
wp-md watch --all        # Watch all sites in folder
wp-md watch --server     # Start WebSocket server for browser extension
wp-md watch --all -s     # Watch all sites + WebSocket

Content Structure

your-site/
├── .env                  # WordPress credentials
├── posts/                # Blog posts
├── pages/                # Pages
├── navigations/          # Navigation menus
├── templates/            # FSE templates
├── template-parts/       # Header, footer, etc.
├── patterns/             # Reusable patterns
├── media/                # Media metadata
├── taxonomies/           # Categories and tags
├── woocommerce/
│   ├── products/         # Products with variations
│   ├── categories/
│   ├── tags/
│   └── brands/
└── theme/
    ├── settings-color.md
    ├── settings-typography.md
    └── styles-blocks.md

File Format

Files use YAML frontmatter + Gutenberg block markup:

---
id: 123
type: page
slug: about-us
status: publish
title: About Us
---
<!-- wp:heading {"level":1} -->
<h1>About Us</h1>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Content here using Gutenberg blocks.</p>
<!-- /wp:paragraph -->

WooCommerce Products

Variable products include attributes and variations in the frontmatter:

---
id: 456
type: product
title: T-Shirt
product_type: variable
regular_price: "29.99"
sku: TSHIRT-001
attributes:
  - name: Size
    options: [Small, Medium, Large]
    variation: true
variations:
  - id: 457
    sku: TSHIRT-SM
    regular_price: "29.99"
    attributes:
      - name: Size
        option: Small
  - id: 458
    sku: TSHIRT-MD
    regular_price: "29.99"
    attributes:
      - name: Size
        option: Medium
---

Add new variations by adding entries without id and running wp-md push.

Installation

# Quick install
curl -fsSL https://raw.githubusercontent.com/tomtev/wp-md/main/install.sh | bash

# Or manual install
git clone https://github.com/tomtev/wp-md.git
cd wp-md && npm install && npm link

Uninstall

curl -fsSL https://raw.githubusercontent.com/tomtev/wp-md/main/uninstall.sh | bash

Authentication

wp-md uses WordPress Application Passwords:

  1. Go to WordPress Admin → Users → Profile
  2. Scroll to Application Passwords
  3. Enter a name (e.g., "wp-md") and click Add New
  4. Copy the generated password
  5. Use it during wp-md init

Configuration

wp-md init creates a .env file with your credentials:

# .env
WP_MD_URL=https://your-site.com
WP_MD_USER=your-username
WP_MD_APP_PASSWORD=xxxx xxxx xxxx xxxx xxxx xxxx
Variable Description
WP_MD_URL Your WordPress site URL
WP_MD_USER WordPress username (admin)
WP_MD_APP_PASSWORD Application password from WordPress

Note: Add .env to your .gitignore to protect credentials.

Multiple Sites

Manage multiple WordPress sites in one project folder:

# Initialize each site in its own folder
wp-md init site-a
wp-md init site-b

# Pull/push with -d flag
wp-md pull -d site-a
wp-md push -d site-b

# Or cd into the folder
cd site-a && wp-md pull

Each folder contains its own .env and content:

project/
  site-a/
    .env              # Site A credentials
    post-types/
    templates/
    theme/
  site-b/
    .env              # Site B credentials
    post-types/
    ...

AI Code Agents

When you run wp-md init, it creates instructions for AI coding assistants:

  • Claude Code: .claude/skills/wp-md/SKILL.md (skill)
  • Cursor & others: content/AGENTS.md

These files teach AI assistants how to work with WordPress content, including Gutenberg block syntax and wp-md commands.

License

MIT

About

Create & edit remote WordPress content as markdown files locally.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •