There is a parameter named “public” where you can set if you want the custom post type to be private or public
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'acme_product',
array(
'labels' => array(
'name' => __( 'Products' ),
'singular_name' => __( 'Product' )
),
'public' => false,
'has_archive' => true,
)
);
}
Related Posts:
- Renaming Custom Post Types and Taxonomies
- Mixing custom post type and taxonomy rewrite structures?
- Resolve a custom post type name vs. page permalink conflict (same slug)
- Can multiple custom post types share a custom taxonomy?
- Mixing regular and custom post types (with meta_query) on home page
- Inconsistent temporary 404s on whole install | PHP error with post-template.php
- Display current taxonomy term when inside custom post type
- Custom post type support for get_users(‘orderby=post_count’);
- Importing old blog with regular posts into new custom post types
- $wp_query->queried_object->ID throws warning: Undefined property
- Adding custom post type to loop
- How can I add dropdown widget/box to admin post page?
- Get posts with tag all post types
- specify meta_key / meta_value condition for prev_post_link and next_post_link
- Debug output during filter execution doesn’t work
- Meta Query “IN” doesn’t work with ACF checkbox filter
- Taxonomy posts on Archive page
- No results searching custom post type in admin panel
- Archive or taxonomy pages not working for custom post type
- Custom template for post type not working
- Frontend posting – everything saves other than checkboxes?
- handling csv data with a custom post type
- Fetch taxonomies by custom post type id array
- Insert Multiple Post with Same Publish Button
- post_type_link not working in gutenberg
- How to modify archive query with pre_get_posts to append CPTs?
- How can I auto-assign a CPT post to category in a custom taxonomy when published?
- Sorting custom post type columns with external data and without meta values
- Mapping Subdomains in WordPress to give the appearance of a localised site, best approach?
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- Polylang non-default language ignores tags in WP_Query
- WP-API select custom taxonomy when creating a post
- Function causing the loop display posting more (empty)
- wp_reset_postdata() and wp_reset_query() inside shortcode are not working to reset original page query
- The loop seems stuck to a single (now deleted) post
- Breadcrumb Not Linking to the Correct Custom Post Type Index Page(s)
- List of Posts and Categories
- Custom post type archive page for multiple post types
- Add a permalink variable onto custom post type URL after post name slug
- Custom fields for custom post type
- Targeting custom post type
- Add the post type to the title of the page
- Show only public custom posts in home page
- Using wp_localize_script to get data from cpt and pass it to maplace-js locations
- Getting Un Wanted Gallery Shortcode In The Page on Loop
- Add term list as class
- Custom Post Type Link added to menu won’t show in frontend
- Taxonomy archive 404ing (not term archive)
- Variable not working in WP_Query
- Alphabetically sort a taxonomy.php template by post title
- Show Taxonomies with admin area for custom post type?
- How do I know if a rewritten rule was applied?
- How to handle new post from API request?
- Loading plugin text domain before registering post type
- Adding Menu Items in Custom Post Types
- Menu’s breaking, now showing all page links on site
- Confusion about how to use Custom Post Types, Custom Taxonomy or Category?
- Limiting Amount of Posts in a Custom Post Type again
- Get taxonomy name used in a current post
- Custom Taxonomy Archive generates 404
- How to hide private posts even if user is admin
- Custom Post type not Querying in switch_to_blog loop
- Custom post type not pulling CSS
- Add link for CPT to another CPT on submit button
- Support for author does not show author column in post table in dashboard
- CPT remove /blog/ by add new portfolio default /blog/%postname%/
- How to make sure, that only the selected post is changing?
- How to make id user can be view content
- Redirect users in first login to a dynamic link
- Custom permalink rewrite rules – how do I fix this?
- How to retrieve custom post type permalink in another cpt?
- Retrieving custom post type fields without a post
- Custom Post Status & Taxonomies
- pre_get_posts with multiple post types AND a meta_key
- Search form to find custom meta box generated data
- Problem to show custom post type in archive page category wise
- Taxonomy Grid Archive Help?
- Show Custom Post Type taxonomy term that matches custom field
- custom post type for custom talbe
- Post being scheduled that shouldnt be schedulded
- paging is not working properly on news archives page [duplicate]
- Custom Post Type and Taxonomy pagination permalink
- Author template – separate custom post type by custom taxonomy term for $curauth
- Custom Loop and Standard Blog Loop Issue
- Custom Post Query Combined with Conditional Tags
- How to Display Custom Taxonomies in an Un-ordered HTML List
- Dealing with variables with gettext function
- how do I create a breadcrumb to work with multiple custom taxonomies
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- Allow admin to determine the order of queries?
- Problems with pagination for a custom post type
- Custom post type permalink structure
- How do I use CPT and permalinks with a mobile theme?
- Knowledgebase / Docs: Custom Post Type, Pages or as a Post Category?
- WordPress custom post type odd and even styling [duplicate]
- Add categories to custom post type
- How to add to taxonomies to a post type
- Custom plugin contact form connecting to mailchimp API
- Posts structure named to blog, how to add month and year
- Update Custom Field daily within 7days