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 post-type list shows which content types a WordPress site has

WordPress
~/tips/tip-wordpress-post-type-list

wp post-type list --fields=name,label,public,hierarchical

Lists every registered post type, including the hidden ones plugins add.

Plugins register their own post types, and many of them never show up in the menu. This command shows the whole list.

wp post-type list --fields=name,label,public,hierarchical

On a plain install you get post, page and attachment, plus internal ones like revision, nav_menu_item, wp_template and wp_navigation. A shop or form plugin adds its own. The name column is what you pass to --post_type in other commands, which is the main reason I’d look it up.

Filters work on any field that get_post_types() knows:

wp post-type list --public=1 --field=name

prints only the public types, one per line, ready for a loop. Add the optional count field to see how many posts each type has.

Post types exist in code, not in the database. When you deactivate the plugin that registered one, the type vanishes from this list, but its posts stay in wp_posts. So if the database is bigger than the list explains, check wp db query for post types that no longer have an owner.

Further reading: wp post-type list

More WordPress tips wp user application-password create anna backup-script --porcelain define( 'MEDIA_TRASH', true ); wp cli check-update wp theme delete --all wp media image-size All WordPress tips (85) All topics

Link