Tip: Find all Post Types used in posts

Home / Tutorials / Core / Tip: Find all Post Types used in posts

Tip: Find all Post Types used in posts

In this post we are going to do some SQL queries to get some quick stats about post types used in a WordPress site. If you ever wanted to find out how many post types are used on your site, read on.

Get Post Types

 

The snippet above queries a list of post types being used on the site.

Usage:

http://yoursite.com/?check_cpt=1 to view the results.

Results:

My Post Types: attachment, discography, fg_gallery, members, movie, my_faq, page, post, revision, staff

Count Post Types

 

The snippet above queries the number of post types being used on the site.

Usage:

http://yoursite.com/?count_cpt=1 to view the results.

Results:

There are 6 Post Types used

Count Number of Post Types uses

 

The snippet above will display the post type and how many times it has been used in the posts table.

Usage:

http://yoursite.com/?count_cpt_stats=1 to view the results.

Results:

attachment(6)
discography(1)
fg_gallery(1)
members(3)
movie(1)
my_faq(7)
page(12)
post(2)
revision(8)
staff(4)

Recent Posts
Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Not readable? Change text. captcha txt

Start typing and press Enter to search