PHP Classes

File: docs/GETTING_STARTED.md

Recommend this page to a friend!
  Packages of Adrian M   QuickWP   docs/GETTING_STARTED.md   Download  
File: docs/GETTING_STARTED.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: QuickWP
Manage WordPress sites using the REST API
Author: By
Last change: feat(drafts): add Drafts review card, Type/Status filters, and 1-click Publish
docs: complete v3.0 documentation, CLI/Webhooks/MCP/AI Concierge guides, and CHANGELOG
v2.2: refactor services, add retry/pagination, shared UI layout, PHP 8.3+, PHPStan L8, and CI
Date: 12 hours ago
Size: 3,896 bytes
 

 

Contents

Class file image Download

Getting Started with QuickWP (v3.0)

This guide walks you through setting up QuickWP from scratch.

Prerequisites

  • PHP 8.3+ with `ext-curl` and `ext-json`
  • Composer for autoloading & dev tools
  • WordPress site with REST API enabled (WordPress 5.6+ for Application Passwords; 5.9+ for Menus)

Installation

1. Clone or Install via Composer

composer require bitshost/quickwp

Or clone directly for standalone CLI / Web UI / MCP usage:

git clone https://github.com/bitshost/quickwp.git
cd quickwp
composer install

2. Create Configuration Files

Copy the example configuration:

cp quick-config.example.php quick-config.php

For multiple sites, also copy:

cp quick-sites.example.php quick-sites.php

Edit quick-config.php with your WordPress site details:

<?php
return [
    'posts_endpoint'  => 'https://your-site.com/wp-json/wp/v2/posts',
    'pages_endpoint'  => 'https://your-site.com/wp-json/wp/v2/pages',
    'media_endpoint'  => 'https://your-site.com/wp-json/wp/v2/media',

    'wp_username'     => 'your-username',
    'wp_app_password' => 'xxxx xxxx xxxx xxxx xxxx xxxx',

    'verify_ssl'      => true,
    'access_mode'     => 'basic', // 'none', 'basic', or 'token'
    'access_basic_user'     => 'admin',
    'access_basic_password' => 'change-this-password',
];

> Security: Never commit quick-config.php or quick-sites.php (both are already in .gitignore).

Creating a WordPress Application Password

  1. Log in to your WordPress admin dashboard.
  2. Go to Users ? Profile ? Application Passwords.
  3. Enter a name (e.g. `QuickWP`) and click Add New Application Password.
  4. Copy the generated password into `wp_app_password`.

Verify Your Setup

Option 1: Verify via CLI (Fastest)

php bin/quickwp site:list
php bin/quickwp site:check --all

Expected output:

[OK  ] main           ( 245 ms) My WordPress Site | user: admin

Option 2: Verify via Web Console

  1. Start the local PHP server:
    php -S localhost:8000 -t public
    
  2. Open `http://localhost:8000` in your browser.
  3. Click Check Site Connection & Auth to verify REST reachability, user roles, and latency.

Option 3: Verify Programmatically

<?php
require_once __DIR__ . '/vendor/autoload.php';

use QuickWP\QuickWP;

$qwp = QuickWP::init(__DIR__, enforceAccess: false);
$health = $qwp->health()->check();

if ($health['ok']) {
    echo "Connected to {$health['site']['name']} as {$health['user']['name']} ({$health['latency_ms']} ms)\n";
} else {
    echo "Connection failed: {$health['error']}\n";
}

Common Setup Issues

  • 401 Unauthorized: Verify username, Application Password (spaces are fine), and ensure your web server passes the `Authorization` header to PHP.
  • 403 Forbidden: Check user role capabilities or security plugins blocking REST endpoints.
  • 404 Not Found: Verify pretty permalinks or switch endpoints to `?rest_route=/wp/v2/posts`.
  • Drafts, search, or status filters ignored (status=draft returns published posts): Check your WordPress `.htaccess` for custom `RewriteRule` rules above `# BEGIN WordPress` (such as `RewriteRule ^(.*)$ index.php?/$1 [L]` without `[QSA]`), which strip query strings (`?status=draft&search=...`) before WordPress sees them. Also ensure LiteSpeed/page cache is not caching `/wp-json/` responses.
  • SSL errors on localhost: Set `'verify_ssl' => false` only for local dev sites.

Next Steps