Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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??

share|improve this question

2 Answers 2

The details of custom post types aren't stored anywhere, they're loaded at runtime with each request via register_post_type calls.

share|improve this answer
    
hmmmm, ok, thats y when I was trying to search for the info in the database, was not seeing them, thanks! –  Noor Apr 19 '12 at 16:16
    
That is not true at all. –  Bainternet Apr 19 '12 at 16:52
    
This may be true of the definition of the custom post type, but it does not address the question of where the data associated with each instance of a custom post type is stored. –  Bob Jones Aug 18 at 19:49
    
@BobJones the question mentions the wp_posts table, so it seems pretty clear they know where the post data is stored. but if you have a different interpretation of the question, then perhaps you should add your own answer. –  Milo Aug 19 at 0:54

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.