This image uses client-cli to extend WP-CLI to provide a command line WP-API client for WordPress.
client-cli uses OAuth 1.0a and requires interaction to link the client application with WordPress.
You'll need a WordPress installation with the rest-api and OAuth 1.0a Server plugins.
Add a new client application using wp api oauth1 add or Admin > Users > Applications in WordPress.
You will need the key and secret.
Simplest is to run (login to the container) interactively, optionally specify the values as convenient environment variables.
mkdir -p wp-cli
chmod +w wp-cli
docker run -it \
-e URL=http://example.com \
-e KEY=XXXXX \
-e SECRET=ZZZZZ \
-v ./wp-cli:/home/wp-cli \
nickbreen/wp-api -i -l
Register the client application using the key and secret.
wpapi oauth1 connect $URL --key=$KEY --secret=$SECRET
... and use it!
wpapi post list $URL
If the client doesn't recognise the command, wp-cli issues the error: Error: This does not seem to be a WordPress install.
Content type
Image
Digest
Size
157.9 MB
Last updated
over 10 years ago
docker pull nickbreen/wp-api