# IMPORTANT: One-Click vs Whitelabel Plugin

This repo contains the **one-click plugin** distributed via WordPress.org. It is NOT the same as the whitelabel plugin generator.

## Two Different Distribution Flows

### 1. One-Click Plugin (THIS REPO)
- **Distributed via**: WordPress.org SVN
- **Updates handled by**: WordPress.org automatically
- **Function prefix**: Always `adaptify_` (hardcoded)
- **Settings persist**: Yes, because prefix never changes
- **Auto-update code**: NOT NEEDED (WordPress.org handles it)
- **Update URI header**: NOT NEEDED (would block WordPress.org updates)

### 2. Whitelabel Plugin (Backend Generator)
- **Distributed via**: Custom download from api.ttsp4712.ai
- **Updates handled by**: Custom auto-update code in plugin
- **Function prefix**: Randomized on each generation (e.g., `sop5945_`)
- **Settings persist**: NO - prefix changes on update, orphaning old settings
- **Auto-update code**: REQUIRED (checks our server for updates)
- **Update URI: false**: REQUIRED (prevents WordPress.org lookup)

## What NOT To Do

1. **DO NOT** add custom auto-update code to this one-click plugin
   - WordPress.org already handles updates
   - Adding it would be redundant and potentially conflicting

2. **DO NOT** add `Update URI: false` to this plugin
   - This would block WordPress.org from notifying users of updates

3. **DO NOT** use randomized function prefixes in this plugin
   - Must stay as `adaptify_` so settings persist across updates

## Deployment

### How to Deploy a New Version

1. **Update version numbers** in these files (must all match):
   - `ada-seo-by-adaptify.php` - `Version:` header
   - `ada-seo-by-adaptify.php` - `Stable tag:` header
   - `readme.txt` - `Stable tag:`

2. **Merge your PR to main**

3. **Create a GitHub Release** - this triggers the deploy:
   ```bash
   gh release create v1.5.X --repo di-su/ada-seo-wordpress-plugin --title "v1.5.X" --notes "Release notes here"
   ```

4. **Wait for GitHub Action** to complete (~45 seconds):
   ```bash
   gh run list --repo di-su/ada-seo-wordpress-plugin --limit 1
   ```

5. **WordPress.org cache** may take a few minutes to update after deploy

### What the GitHub Action Does

When you create a release (e.g., `v1.5.4`), the action automatically:
1. Pushes to WordPress.org SVN using stored credentials (`SVN_USERNAME`, `SVN_PASSWORD`)
2. Creates a ZIP as a GitHub release asset

### Important: Merging PR Does NOT Deploy

The action triggers on `release`, NOT on merge. If you only merge to main without creating a release, nothing gets deployed to WordPress.org.

## Known Issue: Whitelabel Settings Reset

The whitelabel auto-update has a bug: each update generates a NEW random prefix, orphaning old settings. The setting `oldprefix_seo_enable_meta_sync` becomes inaccessible when plugin updates to `newprefix_`.

To fix this properly, the whitelabel flow would need to preserve the prefix across updates.
