WP-CLI Commands

  • JNext lesson
  • KPrevious lesson
  • FSearch lessons
  • EscClear search

Base command: wp dmyip

Available when the modern loading path is active (requires vendor/autoload.php).


wp dmyip shortcode <type>

Get the output of a specific shortcode.

Positional arguments:

  • <type> (required) – Shortcode type

Flags:

  • --offset=<n> (optional, int) – Year offset
  • --date=<YYYY-MM-DD> (optional, string) – Target date for countdown/age types

Examples:

# Basic shortcodes
wp dmyip shortcode year
# 2026

wp dmyip shortcode month
# February

wp dmyip shortcode date
# February 18, 2026

wp dmyip shortcode weekday
# Tuesday

wp dmyip shortcode season
# Winter

# Year with offset
wp dmyip shortcode year --offset=5
# 2031

wp dmyip shortcode year --offset=-10
# 2016

# Countdown
wp dmyip shortcode daysuntil --date=2026-12-25
# 310

wp dmyip shortcode dayssince --date=2020-01-01
# 2240

# Age
wp dmyip shortcode age --date=1990-05-15
# 35

# Events
wp dmyip shortcode blackfriday
# November 28

wp dmyip shortcode cybermonday
# December 1

wp dmyip list

List all available shortcodes with descriptions.

Flags:

  • --format=<format> (default: table, options: table, csv, json, yaml)

Examples:

# Default table output
wp dmyip list

# JSON for scripting
wp dmyip list --format=json

# CSV for spreadsheets
wp dmyip list --format=csv

Output columns: shortcode, category, description, example


wp dmyip test

Test all shortcodes and verify they produce output.

wp dmyip test

Tests 17 core shortcode types and reports pass/fail for each. Useful for verifying the plugin is working correctly after updates or migrations.


wp dmyip info

Display plugin version, author, documentation link, and available commands.

wp dmyip info

Scripting Examples

Get values for shell scripts

YEAR=$(wp dmyip shortcode year)
DAYS=$(wp dmyip shortcode daysuntil --date=2026-12-31)
echo "Days remaining in $YEAR: $DAYS"

Verify after deployment

wp dmyip test && echo "All shortcodes working" || echo "FAILED"

Export shortcode list

wp dmyip list --format=json > shortcodes.json

Use in CI/CD

# Verify plugin shortcodes work in staging
wp dmyip test --url=https://staging.example.com