Where are wordpress custom types stored?

I finally found the custom post type data. It is stored in the wp_post table where post_type = custom post type (e.g. “products”). The field (column) data is stored in wp_postmeta where the meta_key is the column name and meta_value is the column value.

This query will bring back all data associated with the custom post type “products”:

SELECT P.ID, P.post_title, M.meta_key, M.meta_value
FROM wp_posts AS P
INNER JOIN wp_postmeta AS M ON M.post_id = P.ID
WHERE P.post_type="products" and P.post_status="publish"
ORDER BY post_title, meta_key

Leave a Comment