Manage plugins¶
Start a new plugin¶
This command runs locally only.
Create a folder with a minimal plugin file. If no arguments or options are passed to the command, they can be entered interactively.
Usage¶
wpc plugin:start [options] [--] [<name> [<slug>]]
Arguments¶
Argument | Description |
---|---|
name | Name of the plugin |
slug | This will be the folder name and the slug of the plugin. If you don’t specify the slug, the name will be used to create one. |
Options¶
The options allow you to set the information in your plugin’s header (see the WordPress documentation).
Option | Description |
---|---|
--plugin-uri=PLUGIN-URI |
Plugin URI plugin header |
--description=DESCRIPTION |
Description plugin header |
--plugin-version=PLUGIN-VERSION |
Version plugin header |
--requires-at-least=REQUIRES-AT-LEAST |
Requires at least plugin header |
--requires-php=REQUIRES-PHP |
Requires PHP plugin header |
--author=AUTHOR |
Author plugin header |
--author-uri=AUTHOR-URI |
Author URI plugin header |
--license=LICENSE |
License plugin header |
--license-uri=LICENSE-URI |
License URI plugin header |
--text-domain=TEXT-DOMAIN |
Text Domain plugin header |
--domain-path=DOMAIN-PATH |
Domain Path plugin header |
--network=NETWORK |
Network plugin header |
--no-interaction | Do not ask any interactive question |
Examples¶
Navigate to your plugins folder then run the command.
$ cd /Users/mkey/Wordpress/wp-content/plugins/
$ wpc plugin:start --author="Happy Monkey" --author-uri="https://mkey.fr" --plugin-version=1.0.0 --no-interaction dummy
Plugin initialized at path : /Users/mkey/Wordpress/wp-content/plugins/dummy
You can set your plugin’s information interactively.
$ wpc plugin:start
Plugin name: <dummy>
Would you like to define plugin additional headers ? [N/y] <y>
Plugin URI: <>
Description: <Lorem ipsum dolor sit amet>
Version: <1.0.1>
Requires at least: <6.0>
Requires PHP: <8.2>
Author: <Happy Monkey>
Author URI: <https://mkey.fr>
License: <>
License URI: <>
Text Domain: <dummy>
Domain Path: <>
Network:<>
Plugin initialized at path : /Users/mkey/Wordpress/wp-content/plugins/dummy
$ cat dummy/dummy.php
<?php
/**
* Plugin Name: dummy
* Description: Lorem ipsum dolor sit amet
* Version: 1.0.1
* Requires at least: 6.0
* Requires PHP: 8.2
* Author: Happy Monkey
* Author URI: https://mkey.fr
* Text Domain: dummy
* Update URI: https://registry.wp-content.io
*
* Generated by WPC-CLI Generator (https://wp-content.io).
*/
Extract manifest¶
This command runs locally only.
Get plugin details from plugin's header.
Usage¶
wpc plugin:manifest [options] [<file>]
Arguments¶
Argument | Description |
---|---|
file |
Path to plugin file |
Options¶
Option | Description |
---|---|
--get=PROPERTY |
Property to extract |
Examples¶
Display plugin's info in a table :
$ wpc plugin:manifest dummy/dummy.php
+-----------------+--------------------------------------+
| Name | dummy |
| PluginURI | |
| Version | 1.0.1 |
| Description | Lorem ipsum dolor sit amet |
| Author | Happy Monkey |
| AuthorURI | https://mkey.fr |
| TextDomain | dummy |
| DomainPath | |
| Network | |
| RequiresWP | 6.0 |
| RequiresPHP | 8.2 |
| UpdateURI | https://registry.wp-content.io |
| RequiresPlugins | |
| _sitewide | |
+-----------------+--------------------------------------+
Or extract it in json format :
$ wpc plugin:manifest --output=json dummy/dummy.php > manifest.json
$ cat manifest.json
{"Name":"dummy","PluginURI":"","Version":"1.0.1","Description":"Lorem ipsum dolor sit amet","Author":"Happy Monkey","AuthorURI":"https:\/\/mkey.fr","TextDomain":"dummy","DomainPath":"","Network":"","RequiresWP":"6.0","RequiresPHP":"8.2","UpdateURI":"https:\/\/registry.wp-content.io","RequiresPlugins":"","_sitewide":""}
You can also extract just one property. This can be useful in CI/CD workflows.
$ wpc plugin:manifest --get=Version dummy/dummy.php
1.0.1
List plugins from your account¶
Get plugins list published on your organization.
Usage¶
wpc plugin:ls [options]
Options¶
Option | Description |
---|---|
-p, --paged=PAGE |
Page number |
-c, --per-page=COUNT |
Number of items per page |
Example¶
$ wpc plugin:ls
+-----------------------+------------+---------+-------------------------------------------------------------+------------------+-------------------------------------------------------------------------- Plugins -+-------------+-----------------+----------+--------+--------------+----------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------+------------+-----------------------+
| name | slug | version | author | author_profile | short_description | rating | num_ratings | active_installs | requires | tested | requires_php | download_link | icons | added | last_updated |
+-----------------------+------------+---------+-------------------------------------------------------------+------------------+---------------------------------------------------------------------------+--------+-------------+-----------------+----------+--------+--------------+----------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------+------------+-----------------------+
| Happy Monkey WP Tools | mkey-tools | 1.1.15 | <a href="https://mkey.fr/" target="_blank">Happy Monkey</a> | https://mkey.fr/ | Toolbox permettant de gérer les options d'optimisation et de sécurité. | 0 | 0 | 0 | 6.4 | null | 8.1 | https://wp-content.s3.fr-par.scw.cloud/artifacts/plugins/mkey-tools/mkey-tools-1.1.15-********************************.zip | {"default":"https://registry.wp-content.io/images/plugin.png"} | 2024-10-08 | 2024-10-11 9:01am UTC |
| Dummy Plugin | dummy | 1.0.6 | <a href="https://mkey.fr/" target="_blank">Happy Monkey</a> | https://mkey.fr/ | Fake plugin | 0 | 0 | 0 | 6.4 | null | 8.1 | https://wp-content.s3.fr-par.scw.cloud/artifacts/plugins/dummy/dummy-1.0.6-********************************.zip | {"default":"https://registry.wp-content.io/images/plugin.png"} | 2024-10-16 | 2024-10-16 2:15pm UTC |
+-----------------------+------------+---------+-------------------------------------------------------------+------------------+------------------------------------------------------------------------- Page 1/2 -+-------------+-----------------+----------+--------+--------------+----------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------+------------+-----------------------+
Get plugin information from your account¶
Get plugin information from your organization.
Usage¶
wpc plugin:info <slug>
Arguments¶
Argument | Description |
---|---|
slug |
Slug of plugin on repository |
Example¶
$ wpc plugin:info dummy
+-------------------+--------------------------------------------------------------+
| property | value |
+-------------------+--------------------------------------------------------------+
| name | Dummy Plugin | |
| slug | dummy | |
| version | 1.0.6 | |
| author | <a href="https://mkey.fr/" target="_blank">Happy Monkey</a> | |
| author_profile | https://mkey.fr/ | |
| short_description | Fake plugin |
...
Build a zip¶
This command runs locally only.
Move all directory files into a folder and generate a zip ready to publish on repository. Original folder is not modified.
You can use a .wpcignore
file to exclude specific files and folders from the ZIP archive—just like a .gitignore
. Learn more about ignoring files.
Usage¶
wpc plugin:build [options] [<input>]
Arguments¶
Argument | Default Value | Description |
---|---|---|
input | $PWD | Input directory container plugin sources |
Options¶
Option | Default Value | Description |
---|---|---|
-s, --slug=SLUG |
$PWD | Plugin slug (if no slug is provided, current directory will be used) |
-o, --output-dir=OUTPUT_DIR |
../dist | Output directory for the ZIP file |
-f, --filename=FILENAME |
$(PWD).zip | Zip filename |
-p, --push | If provided, Push zip to repository |
Examples¶
Navigate to your plugin in your local installation then create the zip file.
$ cd /Users/mkey/Wordpress/wp-content/plugins/dummy/
$ wpc plugin:build --output-dir=/Users/mkey/Desktop/ .
+----------+-------------------------------+
| property | value |
+----------+-------------------------------+
| artifact | /Users/mkey/Desktop/dummy.zip |
+----------+-------------------------------+
You can also build a package from everywhere by providing the absolute path.
$ wpc plugin:build /Users/mkey/Wordpress/wp-content/plugins/dummy/
+----------+---------------------------------------------------------+
| property | value |
+----------+---------------------------------------------------------+
| artifact | /Users/mkey/Wordpress/wp-content/plugins/dist/dummy.zip |
+----------+---------------------------------------------------------+
Push an update¶
Upload a zip on repository. If the provided slug exists the plugin will be updated (See plugins section to learn more).
Usage¶
wpc plugin:push [options] <artifact>
Arguments¶
Argument | Description |
---|---|
artifact | Path of zip file to upload. See plugin:build command to generate artifact with CLI. |
Options¶
Option | Default Value | Description |
---|---|---|
-m, --message=MESSAGE |
Release notes associated with the version |
Examples¶
Push a zip with release notes :
$ wpc plugin:push -m "🐛 Fix some bugs" ./dummy.zip
Build and push¶
In most cases, you will need to build and directly push from your working directory. You can use this command to do this :
$ wpc plugin:build --push
$ wpc plugin:build --push -m "🚀 New release"