WP-CLI Commands
Yoko Core provides custom WP-CLI commands under the yoko namespace.
Run commands using:
wp yoko <command> [options]
rel_tax
What It Does
Repairs relational taxonomy assignments for a configured CPT.
Options
cleanup(orrepair) positional command--cpt=<cpt_slug>required target post type
Examples
wp yoko rel_tax cleanup --cpt=resource
wp yoko rel_tax repair --cpt=resource
gfpdf rerender
What It Does
Re-renders Gravity PDF output for a specific Gravity Forms entry.
Behavior:
- Loads the entry and its form.
- Re-renders all active PDFs configured on that form by default.
- Supports targeting one PDF setting via
--pdf_id.
Options
<entry_id>required positional argument--pdf_id=<pdf_id>optional Gravity PDF setting ID (pid)
Examples
wp yoko gfpdf rerender 1234
wp yoko gfpdf rerender 1234 --pdf_id=69de636897366
Notes
- Requires both Gravity Forms and Gravity PDF to be active.
- Prints generated file paths for each re-rendered PDF.
- Legacy alias
wp yoko gravity_pdf_rerenderis still supported with a deprecation warning.
attach_pdf_links
What It Does
Scans content for local PDF links already in Media Library and attaches unattached PDFs to the linking post.
Behavior:
- Supports direct .pdf URLs and PDF attachment permalinks.
- Only attaches when post_parent is 0.
- Skips files already attached to another post.
- Dry run by default; pass --apply to write changes.
Options
--post_type=<post_type[,post_type]>--post_status=<status[,status]>--post_id=<id[,id]>--limit=<number>--offset=<number>--batch_size=<number>--apply--dry-run--verbose
Examples
wp yoko attach_pdf_links --dry-run
wp yoko attach_pdf_links --post_type=page --post_status=publish --verbose
wp yoko attach_pdf_links --post_id=3512 --apply
create_missing_pdf_attachments
What It Does
Scans local .pdf URLs and creates missing attachment records when files exist in uploads but are not registered in Media Library.
Behavior:
- Creates attachment post records.
- Sets attachment guid to the resolved uploads URL.
- Dry run by default; pass --apply to write changes.
Options
--post_type=<post_type[,post_type]>--post_status=<status[,status]>--post_id=<id[,id]>--limit=<number>--offset=<number>--batch_size=<number>--apply--dry-run--verbose
Examples
wp yoko create_missing_pdf_attachments --dry-run
wp yoko create_missing_pdf_attachments --post_type=page --post_status=publish --verbose
wp yoko create_missing_pdf_attachments --post_id=3512 --apply
replace_pdf_urls_with_attachment_permalinks
What It Does
Replaces direct local .pdf URLs with attachment permalinks.
Options
--post_type=<post_type[,post_type]>--post_status=<status[,status]>--post_id=<id[,id]>--limit=<number>--offset=<number>--batch_size=<number>--apply--dry-run--verbose
Examples
wp yoko replace_pdf_urls_with_attachment_permalinks --dry-run
wp yoko replace_pdf_urls_with_attachment_permalinks --post_id=3512 --verbose
wp yoko replace_pdf_urls_with_attachment_permalinks --post_id=3512 --apply
replace_pdf_attachment_permalinks_with_urls
What It Does
Inverse of the previous command. Replaces PDF attachment permalinks with direct .pdf file URLs.
Options
--post_type=<post_type[,post_type]>--post_status=<status[,status]>--post_id=<id[,id]>--limit=<number>--offset=<number>--batch_size=<number>--apply--dry-run--verbose
Examples
wp yoko replace_pdf_attachment_permalinks_with_urls --dry-run
wp yoko replace_pdf_attachment_permalinks_with_urls --post_id=3512 --verbose
wp yoko replace_pdf_attachment_permalinks_with_urls --post_id=3512 --apply
pdf_protection
What It Does
Manages protected file storage for gated PDFs — the support-side equivalent of the "Protect the PDF file" checkbox in the PDF Viewer Options metabox.
protect moves the PDF and its generated preview images out of the public uploads directory into a directory outside the web root, so the direct file URL stops working and the document is served only through the gated streaming endpoint. unprotect moves everything back. status reports the viewer, gating, protection, and teaser state of every PDF in the media library.
Options
protect|unprotect|statuspositional command--id=<attachment_id>required forprotectandunprotect; optional forstatus(omit to report on all PDFs)
Examples
wp yoko pdf_protection status
wp yoko pdf_protection status --id=123
wp yoko pdf_protection protect --id=123
wp yoko pdf_protection unprotect --id=123
Notes
- Protection requires the PDF viewer to be enabled for the document — with the viewer off there is no gated way to serve the file. If the viewer is switched off while a file is protected, the attachment permalink falls back to the gated stream endpoint so the document never becomes unreachable.
statusis the fastest way to confirm protected files survived a migration or staging clone: a row showingprotected: yeswhose file is missing on disk means the protected directory did not come across with the environment.
user_post_counts
What It Does
Reports how many posts each user authored, broken out by post type — the same numbers as the User Content Column on Users → All Users, for sites where the admin is too slow to page through, or for answering "is this account safe to delete?" without loading the UI.
Read-only; it never writes.
Options
[<user>]optional positional argument limiting the report to one user, by ID, login, or email address. This is positional rather than--user=because WP-CLI reserves--userglobally for choosing the account a command runs as.[--hide-empty]omit users who have not authored any content[--format=<format>]table(default),json,csv, oryaml
Examples
wp yoko user_post_counts
wp yoko user_post_counts admin
wp yoko user_post_counts --hide-empty --format=json
soft_gate_tokens
What It Does
Lists the Soft Gate magic-link tokens that have been issued — support's answer to "did this person's access link ever get created?".
The raw token is never stored, only its SHA-256 hash, so this reports when a link was issued and when it expires, never the link itself. Timestamps are UTC.
Read-only; it never writes.
Options
[--email=<email>]only show tokens issued to this address[--limit=<limit>]how many rows to show, newest first (default20)[--format=<format>]table(default),json,csv, oryaml
Examples
wp yoko soft_gate_tokens
wp yoko soft_gate_tokens --email=someone@example.com
wp yoko soft_gate_tokens --limit=100 --format=csv
soft_gate_purge
What It Does
Deletes expired Soft Gate tokens — the same operation the daily
yoko_soft_gate_purge_tokens cron event performs, runnable on demand. Useful on a site
where cron is not firing, or to confirm the cleanup works before trusting it to cron.
Only rows whose expiry has already passed are removed; live tokens are untouched.
Examples
wp yoko soft_gate_purge
soft_gate_revoke
What It Does
Invalidates every Soft Gate access link issued to an email address, so a visitor who has not yet clicked one can no longer use it.
Anyone who has already clicked a link holds an access cookie set in their own browser. No server-side action can withdraw that — it lapses on its own schedule.
Options
--email=<email>required; the address whose links should be revoked[--yes]skip the confirmation prompt
Examples
wp yoko soft_gate_revoke --email=someone@example.com
wp yoko soft_gate_revoke --email=someone@example.com --yes
stretched-links audit
What It Does
Finds Stretched Links that will not do anything.
A stretched link fails quietly by design — with no container ancestor it simply stays an ordinary link, which is the right behavior for visitors and the wrong one for support, because "the card isn't clickable" looks exactly like "nobody set it up". This reports three misconfigurations across the whole site:
dormant-link— a link is set to stretch but no ancestor is a designated containerempty-container— a container is designated but holds no stretched linkcompeting-links— a container holds more than one stretched link, so only the last one rendered is clickable
Read-only; it never writes.
Options
--post_type=<post_type>limit the scan to one post type (default: every post type with content)--format=<format>table(default),csv,json,yaml, orcount
Examples
wp yoko stretched-links audit
wp yoko stretched-links audit --post_type=page --format=json
Notes
- Only post content is scanned. Blocks living in FSE templates and template parts are not covered, so a card built into a template needs checking in the editor.
- An empty report means every stretched link and container on the site is paired correctly.
panel_order
What It Does
Inspects or clears the block editor sidebar panel order.
The order is normally set in the editor (⋮ Options → Reorder sidebar panels). This command is the support hatch: it shows what a site has stored, and puts a site back to WordPress defaults without anyone opening the editor.
Options
listshow the stored order, one row per panelresetdelete the stored order--post_type=<post_type>limit to one post type (default: every post type with a stored order)--yesskip the confirmation prompt onreset
Examples
wp yoko panel_order list
wp yoko panel_order list --post_type=page
wp yoko panel_order reset --post_type=page
wp yoko panel_order reset --yes
Notes
panel_keyvalues are derived in the browser, not in PHP — see how panels are identified.- Resetting a post type removes its entry entirely; WordPress's own panel order returns on the next editor load.
taxonomy_panel
What It Does
Inspects or changes which taxonomies share the consolidated taxonomy panel, per post type.
The choice is normally made in the block editor, by an admin looking at the sidebar. This command is the headless equivalent — for a broken site, a scripted rollout, or confirming what the editor is actually reading.
The stored list is also the panel's order, so add appends and order sets the whole sequence at once.
Options
listshow what is consolidated, one row per taxonomy, in panel orderaddappend a taxonomy to the panel on one post typeremovetake it out againorderset the whole panel order at onceresetclear one post type, or every post type when none is named--post_type=<post_type>the post type whose sidebar is being configured; required foradd,removeandorder, narrowslistandreset--taxonomy=<taxonomy>the taxonomy to add or remove; required for those--taxonomies=<slug,slug,…>comma-separated slugs in panel order; required fororder, and it replaces the list — a slug left out is removed--yesskip the confirmation prompt onreset
Examples
wp yoko taxonomy_panel list
wp yoko taxonomy_panel list --post_type=pet
wp yoko taxonomy_panel add --post_type=pet --taxonomy=pet-type
wp yoko taxonomy_panel remove --post_type=pet --taxonomy=pet-type
wp yoko taxonomy_panel order --post_type=pet --taxonomies=pet-type,altered,pet-age
wp yoko taxonomy_panel reset --post_type=pet --yes
Notes
- The same taxonomy can be consolidated on one post type and not another; that is the point of keying it by post type.
addandremoverefuse a taxonomy the block editor cannot edit on that post type, and list the ones it can.- A taxonomy without
show_in_restis never offered; the block editor cannot edit it, so consolidating it would hide it. - The stored list is the panel's order:
addappends, andorderreplaces the sequence. A panel that has never been ordered by hand follows the order the taxonomies are attached to the post type.
theme_icons
What It Does
Lists the SVG files in the active theme's icon folder, showing which became theme icons and why the rest did not.
WordPress keeps only <svg>, <path> and <polygon> in a registered icon and deletes the rest silently. Yoko Core rewrites what it can and refuses what it cannot, rather than registering an icon that renders as an empty square. This is where the refusals are, on the command line — the same list is on the Site Health screen.
Options
list(default) one row per file: the icon name, whether it registered, the file, and the reason if it did notflushthrow the cached manifest away, so the folder is read again on the next request--format=<format>table(default),csv,jsonoryaml
Examples
wp yoko theme_icons
wp yoko theme_icons --format=json
wp yoko theme_icons flush
Notes
- The folder is cached against the files' own names, sizes and modification times, so an edited icon is picked up on the next request.
flushis for the cases that cannot see — a filter that now returns something different, or a file rewritten to the same size within the same second. registered (stroked)means the icon is an outline, and its stroke is restored by a generated stylesheet rather than by the file. It renders on the front end and in the editor, and as nothing in a context that loads no styles.- Icons come from
icon/andicons/, in the child theme before the parent. - The command errors on WordPress older than 7.1, which is where the icon registry arrived.
Beaver Builder Support
When Beaver Builder is active, replacement commands process both:
- post_content
- _fl_builder_data
Details:
- URLs found only in Beaver Builder module settings are included as candidates.
- _fl_builder_data updates are done via WordPress meta APIs to preserve serialized integrity.
- Verbose output includes explicit lines when a candidate URL is found in Beaver Builder builder data.
- Summary output includes separate counts for _fl_builder_data rewrites.
Suggested Workflow
- Run with --dry-run --verbose.
- Review candidate replacements.
- Re-run with --apply.
- Re-run dry run to confirm no remaining replacements.
Troubleshooting
Unknown --post_id parameter
Update to the latest plugin code and clear opcode cache if enabled.
No candidates found, but page has Beaver Builder PDF buttons
Check:
- Beaver Builder is active.
- The page has _fl_builder_data.
- URLs are local to the same host.
- You are running with --verbose.
Local WP database connection issues
Confirm wp-config.php supports the local wrapper host override:
define( 'DB_HOST', getenv( 'WP_LOCAL_DB_HOST' ) ?: 'localhost' );