Wordpress Website Custom Types
WordPress post types, including both default and popular custom types. However, there are a couple of points to note for accuracy:
-
Default Post Types:
- The default WordPress post types are 'post' and 'page' These are the built-in content types provided by WordPress.
-
Popular Custom Post Types:
- 'news': Often used by news outlets or blogs to separate news articles from regular posts.
- 'event': Used by event management plugins to handle events, dates, and venues.
- 'product': Introduced by e-commerce plugins like WooCommerce to manage store products.
- 'portfolio': Commonly used by creatives to showcase work samples or case studies.
wp_types = wp_types = ['posts', 'pages', 'news', 'events', 'products', 'portfolio']
The WordPress REST API only exposes post types that are registered with the 'show_in_rest'
parameter set to True
. If a custom post type does not have this parameter enabled, it won't appear in the REST API endpoints like /wp-json/wp/v2/types
, and therefore won't be fetched if set to False
Why Some Custom Post Types Are Missing
When developers register custom post types in WordPress, they have the option to include or exclude them from the REST API:
register_post_type('news', array(
'public' => true,
'show_in_rest' => true, // Must be true to appear in the REST API
// ... other arguments
));
If 'show_in_rest'
is set to false
or omitted (since it defaults to false
), the custom post type won't be accessible via the REST API.