# WordPress Connection

RankWiz connects to your WordPress site via a lightweight plugin. This allows RankWiz to read your published posts and pages for content analysis and AI-powered rewriting.

## Prerequisites

- WordPress 6.0 or higher
- PHP 8.1 or higher
- Administrator access to your WordPress site

## Step 1: Install the Plugin

1. Download the RankWiz AI plugin
2. Upload the `rankwiz-ai` folder to your WordPress site's `/wp-content/plugins/` directory
3. In the WordPress admin, go to **Plugins** and activate **RankWiz AI**

## Step 2: Connect from RankWiz

1. In RankWiz, go to your site's onboarding page
2. Click **Connect WordPress**
3. Enter your WordPress site URL (e.g., `https://example.com`)
4. A **setup token** will appear — copy it

## Step 3: Enter the Token in WordPress

1. In your WordPress admin, go to **Settings > RankWiz AI**
2. Paste the setup token into the token field
3. Click **Save**

## Step 4: Verify the Connection

1. Return to RankWiz
2. Click **Verify Connection**
3. RankWiz will contact your WordPress site to confirm the plugin is active and the token matches

Once verified, the connection card turns green and RankWiz begins syncing your content inventory.

## What Gets Synced

RankWiz imports:

- **Post/page titles** and URLs
- **Published content** (HTML body)
- **Post metadata** (publish date, modified date, post type)
- **Yoast SEO fields** (if Yoast SEO is installed): focus keyword, meta title, meta description, robots directives

Only published posts and pages are synced. Drafts, private posts, and other post types are not included.

## Security

All communication between RankWiz and your WordPress site is authenticated using HMAC-SHA256 signatures:

- A shared secret is generated during the handshake and encrypted at rest on both sides
- Every API request from RankWiz includes a cryptographic signature that the plugin verifies
- Requests without a valid signature are rejected
- The plugin provides **read-only** access — RankWiz cannot modify your WordPress content

## Disconnecting

To disconnect from RankWiz:

1. Go to your site's onboarding page in RankWiz
2. Click **Disconnect** on the WordPress card
3. Confirm the action

You can also disconnect from the WordPress side via **Settings > RankWiz AI**.

Previously synced content data is retained in RankWiz until the site is deleted.

## Reconnecting

If you need to reconnect (e.g., after changing your WordPress URL), disconnect first, then repeat the connection steps above. A new setup token will be generated.

## Troubleshooting

**"WordPress plugin not responding"**
- Verify the plugin is activated in WordPress
- Check that your WordPress site is publicly accessible (not behind HTTP auth or maintenance mode)
- Ensure the URL you entered matches your WordPress site exactly

**"Verification failed"**
- Double-check that the setup token was saved in the WordPress plugin settings
- Try disconnecting and reconnecting with a fresh token

**Plugin not appearing in WordPress**
- Confirm the `rankwiz-ai` folder is in `/wp-content/plugins/`
- Check that your server meets the requirements: PHP 8.1+, WordPress 6.0+
