[00] Subset SEO, For developers
WP-CLI commands
Every wp subset seo command in Subset SEO and SEO Pro, with its options, defaults and examples as wp help prints them.
Subset SEO adds its commands under wp subset seo. The Pro commands appear once Subset SEO Pro is active. Run wp help subset seo <command> on your site to see the same text there.
import
Imports titles, descriptions, robots, social values, keyphrases, primary terms and settings from another SEO plugin. The other plugin doesn’t need to be active, and its data is never changed. Values Subset SEO already has are kept unless you add --overwrite, so running the import twice changes nothing the second time. Redirects are counted but not imported: Subset Redirects imports them.
Without a source, it lists the plugins you can import from and whether this site has their data.
wp subset seo import [<source>] [--dry-run] [--overwrite]
| Option | Default | What it does |
|---|---|---|
<source> | None | The plugin to import from: yoast, rank-math, aioseo or seopress. |
--dry-run | Off | Reports what would be imported without changing anything. |
--overwrite | Off | Replaces values and settings Subset SEO already has. |
wp subset seo import
wp subset seo import yoast --dry-run
wp subset seo import rank-math --overwrite
See Import from another plugin for what each source brings across.
check
Shows what search engines get for a post: its title and description as rendered, its robots directives, its focus keyphrase, the editor’s last analysis, and its links and images as the site sees them. The readability and keyphrase checks run in the editor, so this prints the summary the editor saved. It adds the facts only the site knows: whether each link to this site points at published content, and each image’s size.
wp subset seo check <post> [--format=<format>]
| Option | Default | What it does |
|---|---|---|
<post> | None | The post’s ID. |
--format=<format> | table | Output format: table, json or yaml. |
wp subset seo check 12
meta
Reads and writes a post’s, term’s or user’s SEO values. Writes go through the same sanitisers as the editor.
wp subset seo meta list <type> <id> [--format=<format>]
wp subset seo meta get <type> <id> <field>
wp subset seo meta set <type> <id> <field> <value>
wp subset seo meta wipe [--dry-run] [--yes]
<type> is post, term or user, and <id> is the object’s ID.
| Subcommand | Options | What it does |
|---|---|---|
list | --format: table (default), json, csv or yaml | Lists every SEO value an object has. |
get | <field>, such as title, description, canonical, robots or focus_keyphrase | Prints one SEO value. Text prints as it is. Robots, primary terms and the analysis summary print as JSON. |
set | <field> and <value> | Sets one SEO value, and an empty value clears it. The robots, primary_term and checks fields take JSON. If cleaning the value changes it, a warning says so. |
wipe | --dry-run prints the counts only. --yes skips the confirmation. | Removes every Subset SEO value from posts, terms and authors, as Remove all Subset SEO data on the Tools tab does. |
wipe leaves the settings alone, and the facebook and twitter author fields that other SEO plugins share. On multisite, authors’ values are shared by every site, so they’re only removed when the command runs as a super admin (--user=<super-admin>).
wp subset seo meta list post 12
wp subset seo meta list post 12 --format=json
wp subset seo meta get post 12 title
wp subset seo meta set post 12 title "%%title%% %%sep%% Shop"
wp subset seo meta set post 12 description "Fresh bread, every morning."
wp subset seo meta set post 12 primary_term '{"category":4}'
wp subset seo meta set term 4 robots '{"index":"noindex"}'
wp subset seo meta wipe --dry-run
wp subset seo meta wipe --yes
sitemap
Lists the XML sitemaps and clears their cache.
wp subset seo sitemap list [--format=<format>]
wp subset seo sitemap flush
| Subcommand | Options | What it does |
|---|---|---|
list | --format: table (default), json, csv or yaml | Lists the sitemaps (one per post type and taxonomy, plus authors) with how many files each has. |
flush | None | Clears the sitemap cache, so every sitemap is rebuilt on its next visit. |
settings
Lists, reads and changes the plugin’s settings. Only known names are accepted, and values are cleaned the same way the settings screen cleans them. A setting pinned by a constant in wp-config.php can’t be changed here either.
wp subset seo settings list [--format=<format>]
wp subset seo settings get <name> [--format=<format>]
wp subset seo settings set <name> <value>
wp subset seo settings reset [--yes]
wp subset seo settings export [<file>]
wp subset seo settings import <file>
| Subcommand | Options | What it does |
|---|---|---|
list | --format: table (default), json, csv or yaml | Lists every setting, its value and its source: default, saved, filter or constant. |
get | --format: plain (default) or json | Prints one setting’s value. |
set | None | Changes one setting. Booleans take true/false, yes/no, on/off or 1/0. Lists take a JSON array or comma-separated values. |
reset | --yes skips the confirmation | Puts every Subset SEO setting back to its default. Settings that add-ons such as Subset SEO Pro keep in the same option are left alone, and so are settings pinned by a constant. |
export | [<file>]: where to write it. Without it, the screen. | Prints every setting as JSON, or writes it to a file. |
import | <file>: the export, or - to read standard input | Replaces the settings with an export’s. Values are cleaned as the settings screen cleans them, and keys Subset SEO doesn’t know are dropped. |
wp subset seo settings export seo.json
wp subset seo settings import seo.json
wp subset seo settings reset --yes
generate (Pro)
Generates SEO titles and meta descriptions with AI, for many posts. It uses the AI provider chosen in Subset › SEO › General, with one request per post, and runs in the foreground until it’s done. If you stop it part way (Ctrl-C), the run keeps its place: run the command again, or open Subset › SEO › Generate, to carry on from the next post.
wp subset seo generate [--post_type=<types>] [--filter=<filter>] [--apply] [--yes] [--status] [--cancel]
| Option | Default | What it does |
|---|---|---|
--post_type=<types> | post | Comma-separated post types. |
--filter=<filter> | missing_description | Which posts: missing_description, missing_title or all. |
--apply | Off | Writes each suggestion to its post straight away instead of keeping it for review. |
--yes | Off | Doesn’t ask before starting. |
--status | Off | Shows the current or last run, and does nothing else. |
--cancel | Off | Cancels the current run, and does nothing else. |
wp subset seo generate --post_type=post,page
wp subset seo generate --post_type=product --filter=all --apply --yes
audit (Pro)
Audits published posts against the site audit’s rules, and lists the results.
wp subset seo audit run
wp subset seo audit status [--format=<format>]
wp subset seo audit list [--rule=<rule>] [--post_type=<type>] [--format=<format>]
| Subcommand | Options | What it does |
|---|---|---|
run | None | Audits every published post. Runs in the foreground until it’s done, and carries on an audit that’s already going instead of starting over. |
status | --format: table (default), csv or json | Shows the audit’s progress, or how many posts break each rule. |
list | --rule (default issues), --post_type, and --format: table (default), csv, json, ids or count | Lists audited posts. --format=csv writes the same file as the screen’s export. |
--rule takes issues (posts that break any rule), all, or one rule: title_missing, title_duplicate, title_long, description_missing, description_duplicate, description_long, thin_content, keyphrase_shared, noindex_in_menu, no_featured_image, orphaned or analysis_problems.
wp subset seo audit run
wp subset seo audit status
wp subset seo audit list --rule=description_missing --post_type=page
wp subset seo audit list --format=csv > audit.csv
links (Pro)
Builds and reads the internal link index.
wp subset seo links rebuild
wp subset seo links status
wp subset seo links orphans [--post_type=<type>] [--format=<format>]
| Subcommand | Options | What it does |
|---|---|---|
rebuild | None | Indexes the links and prominent words of every published post. Runs in the foreground until it’s done, and carries on a rebuild that’s already going. |
status | None | Shows how far the index is built. |
orphans | --post_type (default post), and --format: table (default), csv, json, ids or count | Lists published posts that no other published post links to. |
wp subset seo links rebuild
wp subset seo links orphans --post_type=page
videos (Pro)
videos scan finds the videos in published posts, then flushes the sitemaps’ cache.
wp subset seo videos scan [--force]
| Option | Default | What it does |
|---|---|---|
--force | Off | Looks again in posts whose content hasn’t changed since the last scan, and asks YouTube and Vimeo about their videos again. |
Feature settings (Pro)
Subset SEO Pro adds a settings command for some of its settings tabs: wp subset seo sitemaps settings, wp subset seo local settings, and wp subset seo woocommerce settings when WooCommerce is active. Each changes one field at a time, cleans values the way its settings tab does, and refuses a value the tab would throw away.
| Subcommand | Options | What it does |
|---|---|---|
list | --format: table (default), json, csv or yaml | Lists every setting, its value and its source: default, or saved when it differs from the default. |
get | --format: plain (default) or json | Prints one setting’s value. |
set | None | Changes one setting. Booleans and lists take the same forms as settings. |
reset | --yes skips the confirmation | Puts every one of these settings back to its default. |
wp subset seo sitemaps settings list
wp subset seo sitemaps settings set news true
wp subset seo local settings get location.phone
wp subset seo woocommerce settings set brand product_brand