WP-CLI

Introduction

The Assely framework provides a bunch of ready to use WP-CLI commands, which help you develop and debug your application.

Usage

Before running the commands below make sure to navigate to the WordPress root directory (like when using the WP-CLI), otherwise, they won't be available.

For Trellis, you have to login into Vagrant with vagrant ssh command and navigate to the /srv/www/<project-name>/current directory.

Commands

The Assely framework provides a bunch of ready to use WP-CLI commands, which help you develop and debug your application.

wp assely:make

Helps scaffold Assely application singularities.


Creating controllers

Scaffolds application controller to app\Http\Controllers directory.

wp assely:make controller <classname>

Creating posttypes

Scaffolds application post type to app\Posttypes directory.

wp assely:make posttype <classname>
Options
--slug – Specify posttype slug.

Creating taxonomies

Scaffolds application taxonomy to app\Taxonomies directory.

wp assely:make taxonomy <classname>
Options
--slug – Specify taxonomy slug.
--belongsto – Specify where taxonomy belongs to.

Creating metaboxes

Scaffolds application metabox to app\Metaboxes directory.

wp assely:make metabox <classname>
Options
--slug – Specify metabox slug.
--belongsto – Specify where metabox belongs to.

Creating commands

Scaffolds application command to app\Console\Commands directory.

wp assely:make command <classname>
Options
--command – Name of the command.
--method – Name of the command method.

wp assely:clear

Helps clear Assely application various caches.


Clearing views cache

Removes all views cache stored in storage/framework/views.

wp assely:clear views

Clearing cache transients

Removes all expired cache transients.

wp assely:clear cache
Options
--all – Clear entire cache transients. Important, it removes all expired and not expired transients.

Clearing rewrite rules

Flushes application rewrite rules.

wp assely:clear rewrites

wp assely:info

Provides various command which helps debugging your Assely application.

Showing registered routes

Displays all registered application routes.

wp assely:info routes

+-------------+--------+----------------------+---------------------+--------------+-------------------------------------------+
| Condition   | Filter | Action               | Parameters          | Pattern      | Guid                                      |
+-------------+--------+----------------------+---------------------+--------------+-------------------------------------------+
|             |        | HomeController@index | []                  |              | index.php?                                |
| docs        |        | DocsController@index | []                  | docs         | index.php?post_type=docs                  |
| docs/{name} |        | DocsController@show  | {"name":"([^\/]+)"} | docs/([^/]+) | index.php?post_type=docs&name=$matches[1] |
| 404         |        | {}                   | []                  |              |                                           |
+-------------+--------+----------------------+---------------------+--------------+-------------------------------------------+

Showing registered assets

Displays all registered application assets in website area.

wp assely:info assets

+----------------------+--------+---------------+-------+-----------+-----------+---------+
| Slug                 | Type   | Path          | Area  | Placement | Execution | Version |
+----------------------+--------+---------------+-------+-----------+-----------+---------+
| app-styles           | style  | css/app.css   | theme | screen    | []        |         |
| app-scripts          | script | js/all.js     | theme | footer    | []        |         |
+----------------------+--------+---------------+-------+-----------+-----------+---------+
Options
--all – Display all registered assets across all areas.
wp assely:info assets --all

Showing registered menus

Displays all registered application menus.

wp assely:info menus

+---------+-----------------+--------+
| Slug    | Top level items | Active |
+---------+-----------------+--------+
| primary | 3               | true   |
+---------+-----------------+--------+

Showing registered sidebars

Displays all registered application menus.

wp assely:info sidebars

+------+---------------+-----------------------------------------+-------------+
| Slug | Title         | Description                             | Has widgets |
+------+---------------+-----------------------------------------+-------------+
| docs | Documentation | Area below documentation sections menu. | false       |
+------+---------------+-----------------------------------------+-------------+

wp assely:salts

Provides helper for managing WordPress salts.

Generating salts

wp assely:salts generate

This will output environment variables that you can copy and paste to your .env file.

AUTH_KEY='random-salt-token'
SECURE_AUTH_KEY='random-salt-token'
LOGGED_IN_KEY='random-salt-token'
NONCE_KEY='random-salt-token'
AUTH_SALT='random-salt-token'
SECURE_AUTH_SALT='random-salt-token'
LOGGED_IN_SALT='random-salt-token'
NONCE_SALT='random-salt-token'
Options
--format – Allows for outputing variables in diffrent format. Accepted values: env, yaml, constant.
wp assely:salts generate --format="constant"