Where are wordpress custom types stored?

Where are custom types stored? Because when a custom type is created, in wp_posts, the post type is set to the <new_custom_post_type>. But where are the details of the new custom post type stored??

5

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