brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: wp taxonomy list shows every taxonomy your site registers

CLI
~/tips/tip-wordpress-wp-taxonomy-list-object-type

wp taxonomy list --format=csv

Lists registered taxonomies, optionally only those that belong to one post type.

Plugins love adding taxonomies, and after a while I’m not sure which ones my site really has. WP-CLI lists them in one go.

wp taxonomy list --format=csv

The default fields are name, label, description, object_type, show_tagcloud, hierarchical and public. On a plain install the docs show categories, tags, navigation menus, link categories and post formats.

To filter, use a field name as an option. The docs’ example shows the taxonomies attached to posts:

wp taxonomy list --object_type=post --fields=name,public

The answer is a small table with category, post_tag and post_format, all public. Filters work for the fields that get_taxonomies() knows, so you can look at --public=1 too, though the docs only show the object_type one.

There is one optional field, count. Add it when you want the numbers:

wp taxonomy list --fields=name,count

--field=name (singular) prints just that column for each taxonomy, which is handy in a script. The formats are table, csv, json, count and yaml.

A caveat: note the underscore in --object_type. A dash version is a different option name and will not filter the way you expect.

Further reading: wp taxonomy list

More CLI tips printf 'GET /\r\n' | hexdump -C hexdump -C -s 512 -n 64 disk.img wget --limit-rate=2m https://example.com/big-file.iso wget --spider https://example.com/file.zip rg 'apiKey' -g '!*.min.js' -g '!package-lock.json' All CLI tips (46) All topics

Link