The WP SSR framework ships two WP-CLI commands that bridge the gap between code-defined configuration and the live WordPress database. Both commands are registered automatically when the plugin boots and are available through the standardDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Ahondev/portfolio-v2/llms.txt
Use this file to discover all available pages before exploring further.
wp CLI binary. They are especially important in staging and production environments, where the framework’s automatic page registration is intentionally disabled and must be triggered manually.
Project WP-CLI Configuration
The repository root ships awp-cli.yml that points the CLI at the Bedrock directory structure so you never need to pass --path manually:
wp command resolves WordPress from web/wp/ and serves files with web/ as the document root, matching the web-server configuration.
wp pages:sync
Class: Ahon\WPCMS\App\Console\Commands\SyncPages
Signature: pages:sync
Description: Sync pages from code definition to WP
This command iterates every route registered in configuration/routes/web.php — both plain web routes and CPT (Custom Post Type) archive routes — and calls WebRouter::registerPage() for each one. If a corresponding WordPress page does not yet exist, it is created; pages that already exist are left untouched.
When to Use
Indevelopment mode the framework auto-registers pages on each request. In staging and production this automatic registration is disabled for performance and safety, so you must run wp pages:sync manually after:
- Adding a new route to
configuration/routes/web.php - Renaming an existing page’s title or slug
- Setting up a fresh environment from scratch
Example Output
Under the Hood
get_post_type_object('article')->label → "Articles"), then creates a WordPress archive page at the configured path.
wp eloquent:generate
Class: Ahon\WPCMS\App\Console\Commands\GeneratePostTypes
Signature: eloquent:generate
Description: Generate post types PHP classes
This command reads every post type registered with EloquentManager and scaffolds PHP class files in app/PostTypes/. Each generated class extends EloquentCPT and declares a $model property set to the post type slug. A built-in Post class is always generated alongside your custom types.
When to Use
Runwp eloquent:generate after:
- Registering a new custom post type in
configuration/posts.php - Renaming a post type slug
- Performing a fresh project setup
Generated File Example
For a post type registered with the slugarticle, the command produces:
$model property is used throughout the framework to identify the correct post type when building query builders, routes, and REST responses.
The command deletes all existing files in
app/PostTypes/ before regenerating them. Any customisations you add to a generated class — like a category() helper in Article.php — will be lost when you re-run the command. Consider re-running only when adding or renaming post types, not as a routine step.Example Output
Workflow: Adding a New Post Type
Define the post type in configuration/posts.php
Open Then create
configuration/posts.php and require a new post definition file:configuration/posts/project.php:Run wp eloquent:generate
With the post type registered, scaffold the corresponding PHP class:This creates
app/PostTypes/Project.php: