WP-CLI commands
Run the site audit, imports, redirects, link counts, IndexNow and SEO fields from the command line with wp rankflect in RankFlect SEO Pro.
On this page
- Changes are logged and can be undone
- wp rankflect audit
- wp rankflect import
- wp rankflect redirects
- list
- add
- delete
- export
- import
- wp rankflect links rebuild
- wp rankflect indexnow submit
- wp rankflect meta
- get
- set
- FAQ
- Why does WP-CLI say "rankflect" is not a registered command?
- Can I undo a change made from WP-CLI?
- Can I run the audit on a schedule?
RankFlect SEO Pro This feature is part of RankFlect SEO Pro. Start a 14-day free trial or see plans.
RankFlect SEO Pro adds a wp rankflect command to WP-CLI. Use it to run the site audit, import from another SEO plugin, manage redirects and edit SEO fields from a terminal, a deploy script or a cron job. It is handy for agencies that look after many sites.
The commands need WP-CLI on the server and an active RankFlect SEO Pro license. They are not part of the free plugin, so wp rankflect is not a known command there.
To see every command, run:
wp help rankflect
| Command | What it does |
|---|---|
wp rankflect audit |
Run the site audit, or show the last result. |
wp rankflect import |
Import SEO data from another SEO plugin. |
wp rankflect redirects |
List, add, delete, export and import redirects. |
wp rankflect links rebuild |
Rebuild the internal link counts. |
wp rankflect indexnow submit |
Send URLs to IndexNow. |
wp rankflect meta |
Read and write the SEO fields of a post. |
Changes are logged and can be undone
Every write from WP-CLI goes through the Change Log, like a change made in wp-admin. The Dashboard shows these changes with a WP-CLI badge. You can undo them in RankFlect SEO → Change Log.
A command that writes many items at once, such as import or redirects import, saves them as one batch, so you can undo the whole run in one step.
If a command fails, it prints an error and exits with code 1, so scripts can stop on it.
wp rankflect audit
Runs the site audit and prints the score, the grade, a score per category and the issues found. The result is saved like an audit run from the Dashboard, so the admin screens show it too.
wp rankflect audit [--last] [--format=<format>]
| Option | What it does |
|---|---|
--last |
Print the last saved audit instead of running a new one. |
--format=<format> |
table (default) or json. Use json in scripts. |
# Run the audit and print tables.
wp rankflect audit
# Run the audit and print JSON, for scripts.
wp rankflect audit --format=json
# Show the last audit without running it again.
wp rankflect audit --last
The JSON output has score, grade, scanned, generated_at, categories and issues.
wp rankflect import
Imports SEO data from another SEO plugin, the same way as RankFlect SEO → Tools → Import: titles, descriptions, focus keywords, robots, canonical URLs, social fields, term SEO and redirects. See Switch from another SEO plugin.
wp rankflect import <source> [--overwrite] [--dry-run]
| Argument or option | What it does |
|---|---|
<source> |
The plugin to import from: yoast, rankmath, aioseo, seopress, slimseo, tsf, squirrly or redirection. |
--overwrite |
Replace values already set in RankFlect SEO. Without it, only empty fields are filled. |
--dry-run |
Show how many posts and redirects the source has. Nothing is imported. |
Before it imports, RankFlect SEO takes an automatic backup (when automatic backups are on) and prints its ID. When it is done, it prints how many posts, fields and redirects it imported, and the Change Log batch ID.
# See what a Yoast SEO import would bring over.
wp rankflect import yoast --dry-run
# Import from Rank Math and replace existing values.
wp rankflect import rankmath --overwrite
wp rankflect redirects
Manages the redirects on RankFlect SEO → Redirects. See Redirects.
list
Lists redirects, newest first.
wp rankflect redirects list [--search=<text>] [--fields=<fields>] [--format=<format>]
| Option | What it does |
|---|---|
--search=<text> |
Only redirects whose source or target contains this text. |
--fields=<fields> |
Comma-separated fields to show. Default: id,source,target,type,match_type,status,hits. |
--format=<format> |
table (default), json, csv, yaml, count or ids. |
wp rankflect redirects list
wp rankflect redirects list --search=blog --format=json
add
Adds a redirect.
wp rankflect redirects add <source> [<target>] [--type=<code>] [--match=<match>] [--inactive]
| Argument or option | What it does |
|---|---|
<source> |
The path to redirect from, such as /old-page/. With --match=regex, a regular expression. |
<target> |
The path or URL to redirect to. Not needed for 410 and 451. |
--type=<code> |
301 (default), 302, 307, 308, 410 or 451. |
--match=<match> |
exact (default), prefix or regex. |
--inactive |
Save the redirect switched off. |
wp rankflect redirects add /old-page/ /new-page/
wp rankflect redirects add /promo/ https://example.com/sale/ --type=302
wp rankflect redirects add /discontinued/ --type=410
delete
Deletes one or more redirects by ID. Get the IDs from wp rankflect redirects list.
wp rankflect redirects delete 12
wp rankflect redirects delete 12 13 14
export
Exports every redirect as CSV, with the columns source, target, type, match_type and status. Without a file name, the CSV is printed.
wp rankflect redirects export redirects.csv
wp rankflect redirects export > redirects.csv
import
Imports redirects from a CSV file of up to 5 MB and 5,000 rows. It reads the columns source, target, type, match_type and status, and also recognises exports from Redirection, Rank Math and Yoast SEO. A row whose source already has a redirect updates it, so nothing is duplicated. The import is one Change Log batch.
wp rankflect redirects import <file> [--dry-run]
# Only show what would be added, updated or skipped.
wp rankflect redirects import redirects.csv --dry-run
wp rankflect redirects import redirects.csv
wp rankflect links rebuild
Rebuilds the incoming and outgoing internal link counts of every published post. It runs the same two passes as RankFlect SEO → Tools → Rebuild link counts: first each post's outgoing links, then the incoming count of every post.
wp rankflect links rebuild
wp rankflect indexnow submit
Sends one or more URLs of this site to IndexNow (Bing, Yandex, Seznam, Naver and others). URLs on other hosts are skipped. Nothing is sent on sites whose environment type is local or development. If the IndexNow module is off, the command warns you, because search engines then cannot check the key file.
wp rankflect indexnow submit <url>...
wp rankflect indexnow submit https://example.com/new-post/
wp rankflect indexnow submit $(wp post list --post_type=page --field=url)
wp rankflect meta
Reads and writes the RankFlect SEO fields of a post. The fields are:
title, description, focus_keywords, noindex, nofollow, canonical, og_title, og_description, og_image, schema_type, cornerstone, hide_search, hide_archives, robots, primary_term and schema.
get
Shows the SEO fields of a post, or one field.
wp rankflect meta get <post> [<field>] [--format=<format>]
--format applies when every field is shown: table (default), json, csv or yaml.
wp rankflect meta get 42
wp rankflect meta get 42 title
wp rankflect meta get 42 --format=json
set
Sets one SEO field of a post. It prints the old and the new value. The change goes to the Change Log, where you can undo it.
wp rankflect meta set <post> <field> <value> [--dry-run]
- Yes/no fields (
noindex,nofollow,cornerstone,hide_search,hide_archives) take1or0. - An empty value (
"") clears the field. - Variables such as
%title%and%sitename%work in titles and descriptions. --dry-runshows the change without saving it.
wp rankflect meta set 42 title "%title% | %sitename%"
wp rankflect meta set 42 noindex 1
wp rankflect meta set 42 canonical "" --dry-run
FAQ
Why does WP-CLI say "rankflect" is not a registered command?
The commands are part of RankFlect SEO Pro. They load only when the Pro plugin is active and the license is active. The RankFlect SEO header shows Pro when the license is active. Run wp plugin list to see which RankFlect SEO plugin is active. See Install RankFlect SEO Pro and activate your license.
Can I undo a change made from WP-CLI?
Yes. Every write is saved in the Change Log. Imports are saved as one batch, so one click undoes the whole run.
Can I run the audit on a schedule?
Yes. Add wp rankflect audit --format=json to a cron job and read the score from the output. The audit also runs automatically every 7 days on its own.
Was this page helpful?
Related guides
Switch from Yoast SEO, Rank Math or another SEO plugin
Import titles, descriptions, keywords, robots, canonicals, social fields and redirects from Yoast SEO, Rank Math, AIOSEO and others into RankFlect SEO.
Create and manage redirects
Send old URLs to new ones with 301, 302 and 307 redirects in RankFlect SEO, with hit counts, search, automatic slug-change redirects and one-click undo.
The Change Log: history and undo
Every SEO change in RankFlect SEO is logged with before and after values and who made it. Approve agent edits, and revert one change or a whole batch.
Run a site audit and fix issues
Run RankFlect SEO's site audit, read the 0 to 100 SEO health score and fix issues in one click, from indexing and metadata to security and speed.
Still need help?
Email us with your WordPress and RankFlect SEO versions and what you tried. Pro customers get priority replies.