WP-CLI commands

Anansi registers its commands under wp anansi. This page lists every command and subcommand in version 0.5.11, with its options and examples, taken from the command docblocks. wp help anansi <command> prints the same help on your site. Commands that only read never change data; the ones that write (mode, redirects, import, settings import, videos, IndexNow) say so below. Long jobs run in batches with pauses, so they are safe on a live site.

Contents

CommandPurpose
wp anansi statusNews sitemap and video schema status.
wp anansi modeShow or set preview / live.
wp anansi previewCompare a page’s current head tags with Anansi’s.
wp anansi newsPosts in the news sitemap now.
wp anansi videosFind embedded videos and fetch their details.
wp anansi sitemapcheck, urls, flush.
wp anansi redirectslist, add, delete, import, export, test, rebuild.
wp anansi importImport from another SEO plugin.
wp anansi export-settings / import-settingsMove Anansi settings between sites.
wp anansi snapshotsave, compare, list, delete (migration proof).
wp anansi linksstatus, index, embed, suggest.
wp anansi crawlersrobots, llms, bots.
wp anansi indexnowsubmit, status, flush.
wp anansi tweaksstatus.

wp anansi status

Shows whether the news sitemap and video schema are on, and whether they run standalone, next to Rank Math free, or paused because Rank Math PRO is active.

wp anansi status

wp anansi mode

Shows or sets the mode. Writes the anansi_mode option when a mode is given.

wp anansi mode [<mode>]
ArgumentDescription
<mode>preview or live. Leave out to show the current mode.

The output also says whether Anansi is in charge, and which SEO plugin it is waiting for, if any.

wp anansi mode
wp anansi mode live

wp anansi preview

Compares what a page prints now with what Anansi would print (head tags), using a signed preview request.

wp anansi preview <url>... [--all] [--format=<format>]
OptionDescription
<url>...One or more URLs or paths on this site.
--allShow matching rows too, not only differences.
--format=<format>table (default), json or csv.
wp anansi preview / /about/ /blog/page/2/

wp anansi news

Lists the posts the news sitemap would show now. Works even while Rank Math PRO is active.

wp anansi news [--xml]
OptionDescription
--xmlPrint the sitemap XML instead of a table.
wp anansi news

wp anansi videos

Finds embedded videos and fetches their details, in small batches. Writes video details to post meta, and contacts YouTube or Vimeo.

wp anansi videos [--post=<ids>] [--force] [--dry-run] [--batch=<n>] [--sleep=<seconds>]
OptionDescription
--post=<ids>Comma-separated post IDs. Default: every published post of the video post types.
--forceFetch details again even for videos already stored.
--dry-runOnly report what would be found. Nothing is fetched or saved.
--batch=<n>Posts per batch. Default 25.
--sleep=<seconds>Pause between batches. Default 2.
wp anansi videos --dry-run
wp anansi videos --post=123,456 --force

wp anansi sitemap

Checks Anansi’s XML sitemaps. Sitemaps are built in-process, with no HTTP request. check and urls work in any mode, also while Rank Math is active, so you can check before switching.

wp anansi sitemap check

Builds every sitemap, validates its XML and compares the URLs with the published, indexable content.

wp anansi sitemap check [--show=<n>]
OptionDescription
--show=<n>How many differing URLs to print per sitemap type. Default 20.
wp anansi sitemap check

wp anansi sitemap urls

Prints the URLs of one sitemap type.

wp anansi sitemap urls <type> [--page=<n>] [--format=<format>]
OptionDescription
<type>A post type (post, page, …), a taxonomy (category, …), author, or index.
--page=<n>Page number for paginated types. Default 1.
--format=<format>table, csv, json or urls (one URL per line, default).
wp anansi sitemap urls post --page=2
wp anansi sitemap urls index --format=table

wp anansi sitemap flush

Clears the sitemap cache. The cache is only used when “Cache sitemaps” is on.

wp anansi sitemap flush

wp anansi redirects

Manages redirects.

wp anansi redirects list

wp anansi redirects list [--status=<status>] [--search=<text>] [--source=<which>] [--format=<format>]
OptionDescription
--status=<status>active, inactive, trashed or any. Default: all but trashed.
--search=<text>Search sources, destinations and notes.
--source=<which>anansi (default) or rank-math (read-only view of Rank Math’s table before the import).
--format=<format>table (default), csv, json, count, ids.
wp anansi redirects list --status=active --format=csv

wp anansi redirects add

Adds a redirect, with the same checks as the admin form, including the loop check. Writes.

wp anansi redirects add <source> [<destination>] [--code=<code>] [--comparison=<comparison>] [--ignore-case] [--inactive] [--notes=<notes>]
OptionDescription
<source>Source path or URL.
<destination>Destination URL or path. Not needed for 410 and 451.
--code=<code>301 (default), 302, 307, 410 or 451.
--comparison=<comparison>exact (default), contains, start, end or regex.
--ignore-caseMatch the source in any case (exact only).
--inactiveSave as inactive.
--notes=<notes>Notes.
wp anansi redirects add /old-post/ /new-post/
wp anansi redirects add old-category --comparison=start --code=410

wp anansi redirects delete

Deletes redirects for good. Writes.

wp anansi redirects delete <id>...

wp anansi redirects import

Imports redirects from a CSV file. Sources that already have a redirect are skipped. Writes unless --dry-run.

wp anansi redirects import <file> [--dry-run]
OptionDescription
<file>CSV file (source,destination,code…, or Anansi’s export format).
--dry-runCount only.

wp anansi redirects export

Exports redirects as CSV.

wp anansi redirects export [--file=<file>] [--status=<status>]
OptionDescription
--file=<file>Write to this file instead of the screen.
--status=<status>active, inactive, trashed or any (default).

wp anansi redirects test

With a URL: shows which redirect answers it. With --all: requests every active exact source through the front end and reports the status and Location. Falls back to Anansi’s internal matching when the site cannot request itself.

wp anansi redirects test [<url>] [--all] [--internal] [--limit=<n>] [--format=<format>]
OptionDescription
<url>URL or path to test.
--allTest every active exact source (Anansi’s, plus Rank Math’s until the import).
--internalDo not send HTTP requests; use internal matching only.
--limit=<n>Test at most n sources.
--format=<format>table (default), csv, json.
wp anansi redirects test /old-post/
wp anansi redirects test --all --format=csv

wp anansi redirects rebuild

Rebuilds the lookup index and match cache. Run it after editing the redirect tables directly in the database.

wp anansi redirects rebuild

wp anansi import

Imports SEO data from another plugin, or shows what can be imported. It always runs a dry run first and prints its report. It writes only Anansi’s own fields, never changes the old plugin’s data, and never replaces a value Anansi already has unless --overwrite is given. It is safe to run again. A stopped import carries on where it stopped (use --restart to begin again).

wp anansi import <source> [--dry-run] [--overwrite] [--batch=<n>] [--only=<phases>] [--pause=<ms>] [--restart] [--yes]
OptionDescription
<source>rank-math, yoast, aioseo, seopress, tsf, redirection, or detect (list what each plugin has), or status (show the last run).
--dry-runOnly report; change nothing.
--overwriteReplace values Anansi already has.
--batch=<n>Objects per batch, 1–50. Default 50.
--only=<phases>Comma-separated phases: settings, posts, terms, users, redirects.
--pause=<ms>Pause between batches in milliseconds. Default 200.
--restartStart over instead of resuming an unfinished import.
--yesDon’t ask before importing after the dry run.
wp anansi import detect
wp anansi import yoast --dry-run
wp anansi import rank-math --yes
wp anansi import status

wp anansi export-settings and import-settings

wp anansi export-settings

Exports all Anansi settings as JSON. Keys, caches and logs are left out.

wp anansi export-settings [--file=<path>]
wp anansi export-settings --file=anansi-settings.json

wp anansi import-settings

Imports Anansi settings from a JSON file made by export-settings. Writes unless --dry-run. Only the options listed by the anansi/settings_io/importable filter can be written.

wp anansi import-settings <file> [--dry-run]
OptionDescription
<file>JSON file.
--dry-runOnly list what would change.
wp anansi import-settings anansi-settings.json

wp anansi snapshot

Migration proof: snapshot the SEO output before switching plugins, then compare after.

wp anansi snapshot save

Saves a snapshot of what the site prints now. Run it while the old plugin is still active. It fetches a sample of URLs of every page type (home, posts, pages, archives, authors, date, search, 404, paginated), a sample of redirect sources, and the XML sitemaps.

wp anansi snapshot save <name> [--urls=<file>] [--sample=<n>]
OptionDescription
<name>Snapshot name, for example before-switch.
--urls=<file>Extra URLs or paths, one per line.
--sample=<n>Items per page type. Default 3.
wp anansi snapshot save before-switch --sample=5

wp anansi snapshot compare

Fetches the same URLs again and shows every difference.

wp anansi snapshot compare <name> [--preview] [--all]
OptionDescription
<name>Snapshot name.
--previewCompare with what Anansi would print (preview), before switching.
--allList every differing row, not just the first 200.
wp anansi snapshot compare before-switch
wp anansi snapshot compare before-switch --preview

wp anansi snapshot list

Lists snapshots.

wp anansi snapshot delete

Deletes a snapshot.

wp anansi snapshot delete <name>

Internal link suggestions.

SubcommandSynopsisDescription
statuswp anansi links statusShows the provider (Ariadne, Voyage AI or the local index) and index coverage.
indexwp anansi links index [--rebuild]Builds the local index now, in batches of 50. --rebuild re-indexes every post, not only new and edited ones.
embedwp anansi links embed [--batches=<n>]Embeds posts with Voyage AI now. Needs a key and respects the daily limit. --batches is how many batches of 50 to send (default 1). Sends post text to Voyage AI.
suggestwp anansi links suggest <post_id>Prints suggestions for a saved post.
wp anansi links status
wp anansi links index --rebuild
wp anansi links suggest 123

wp anansi crawlers

Inspect robots.txt, llms.txt and AI bot rules. All read-only.

SubcommandDescription
wp anansi crawlers robotsPrints the robots.txt WordPress would serve now.
wp anansi crawlers llmsPrints the llms.txt body, built fresh (not from the cache).
wp anansi crawlers botsLists the AI bots and whether robots.txt blocks each.

wp anansi indexnow

wp anansi indexnow submit

Sends URLs to IndexNow now. More than 100 are split into several requests. Sends the URLs to IndexNow.

wp anansi indexnow submit <url>...
wp anansi indexnow submit https://example.com/hello-world/

wp anansi indexnow status

Shows the settings, key URL, queue and the latest log entries.

wp anansi indexnow status [--log=<n>]
OptionDescription
--log=<n>Log entries to show. Default 10.

wp anansi indexnow flush

Sends the queued URLs now instead of waiting for cron.

wp anansi indexnow flush

wp anansi tweaks

wp anansi tweaks status

Lists the tweaks (category base, redirects, link and image attributes, RSS, comments), their setting and whether they run now.

wp anansi tweaks status [--format=<format>]
OptionDescription
--format=<format>table (default), csv, json or yaml.

A typical migration run

# While Rank Math (or Yoast) is still active:
wp anansi import detect
wp anansi snapshot save before-switch --sample=5
wp anansi import rank-math --dry-run
wp anansi import rank-math --yes
wp anansi snapshot compare before-switch --preview
wp anansi sitemap check

# Deactivate the old plugin, then:
wp anansi mode live
wp anansi snapshot compare before-switch
wp anansi redirects test --all