Long time no see affable space durian!

: Clippy, bash / zsh commands, CSS Color

wp-cli

Install

see: https://www.cyon.ch/blog/Mit-WP-CLI-WordPress-auf-der-Kommandozeile-verwalte

Troubleshooting section at the bottom of the page

Commands

  • wp plugin update [options below]
    • <plugin-name(s)>
    • --all : updates all plugins
    • --dry-run : Preview which plugins would be updated.
    • --exclude=<pluin-name(s)>
  • wp core check-update and wp core update
  • wp option get blog_public
    • checks if blog is search engine crawlable, returns 1 or 0.
    • append 1 to enable, 0 to disable
  • wp config get
    • reads out wp config file
  • wp core version
    • Returns current version number of WP install
  • wp core verify-checksums
    • Verify md5 checksums against current version on WordPress.org
    • --version=4.9.9 : Check for specific version
  • wp search-replace '//temporarydomain.com' '//finaldomain.com'
    • Search + replaces database entries
    • Always use --dry-run first to prevent f*#©<ups

See: Handbook

Aliases

Install wp-cli locally, then add the aliases as follows to the wp-cli/config.yml

@aliasname
    ssh: user@server/path/to/wp
@otheralias
    ssh:otheru@others/path/to/wp
@aliasgroup
    - @aliasname
    - @otheralias

Usage: wp <aliasname|group|@all> <command>.

Examples:

  • wp @otheralias core check-update
  • wp @all option get blog_public

See: WP-Cli Commands Handbook | Jason Yingling

wp-cli + Alfred App

Alfred app:

  • Create a workflow with an external trigger
  • Copy the sample code
  • escape the quotes (\")

Terminal Command Action

v=$(wp @nekos core version);
/usr/bin/osascript -e "tell application \"Alfred 3\" to run trigger \"myTrigger\" in workflow \"ch.lnrz.wphelpers\" with argument \"$v\""
  • v=$(wp @nekos core version); runs the comands and stores it to the variable v
  • /usr/bin/osascript -e "tell ... executes apple script which calls the external trigger myTrigger of the workflow ch.lnrz.wphelperswith the argument of the variable v
    • Note: the actionscript command must be wrapped in quotes (thus the escaping beforhand)

Trouble shooting

Tab completition in zsh

Symptom: comand nof found: complete

For Tab completion in zsh use the following lines in the .zshrc or the sourced .bash_profile [s]:

autoload bashcompinit
bashcompinit
source ~/.wp-cli/wp-completion.bash

Trouble with remote $PATH

Symptom:command not found: wp

See: Making WP-CLI accessible on a remote server (WP Handbook)
=> third solution (before_ssh) worked for me (dont forget the <?php ... ?> Tags in the included file)