register_post_type
allows you to specify whether a post is ‘publicly_queryable’
publicly_queryable
(boolean) (optional) Whether queries can be performed on the front end as part of parse_request().Default: value of public argument
Note: The queries affected include the following (also initiated when rewrites are handled)
- ?post_type={post_type_key}
- ?{post_type_key}={single_post_slug}
- ?{post_type_query_var}={single_post_slug}
It doesn’t mention anything about queries of the form ?p=
, and from memory, these will still serve your custom post types event with the publicly_queryable set to false. To prevent this you can hook onto template_redirect
and redirect to a different (404?) page.
Related Posts:
- Pagination not working with custom loop
- Advanced search form with filters for custom taxonomies and custom fields
- WordPress 3.3 custom post type with /%postname%/ permastruct?
- Custom Taxonomy’s Label to change the text appearing in Appearance > Menu
- Have different search results template depending of custom post type searched
- Why does a custom post type need the ”hierarchical’ args setting?
- How do I programmatically add items of content to a custom post type?
- order by meta_value serialized array
- bulk Update post_meta with default values
- WP_Query pagination using only numbers instead of /page/1 on URL
- How do I set the content for a post of a particular CPT?
- Output the slug and name of a CPT single post taxonomy term
- Slug for standard post post_type
- Custom post types – show specific posts
- Paginate_links links not working accordingly to how I do query the page
- Parent page using wp_dropdown_pages and multiple post types
- Updating post title using wp_update_post
- Remove parent from custom post type
- Add nonexisting pages to navigation
- How to add plugin custom field to custom post type?
- Multiple post type queries (with specific arguments for each)
- Troubles with making a custom template for posts
- Custom Post Type and Labels
- related posts – pulling tags from a specific post type
- WP 3.0.5 – Custom posts matching 2 taxonomies
- Custom Post Type Loop within Shortcode
- How can you handle rewrite rules for custom post types with option to filter on custom taxonomy terms?
- How do I make a custom taxonomy for a CPT appear inbetween title and editor boxes?
- How to add post_type=value when editing that post type in the WordPress admin?
- Change archive page template using pre_get_post
- Force documents to appear in Featured Image dialogue
- Custom post type redirected to homepage – how to debug
- Filtering WP_Query Dynamically on the Front-End
- How to retain $_POST data when submitting form to custom page
- Query with no terms uses index.php template instead of archive.php
- custom taxonamy and post type
- retrieve Meta field value from CPT and set those values as Image Meta Field “Title”
- Taxonomy custom post type URL
- Custom post type archive page – Posts overview – with one modal for multiple posts?
- Getting categories of posts under a custom taxonomy
- How do I display the taxonomy for a custom post type in an array
- Is it possible to to use custom post type types on a page with the same slug somehow?
- WordPress custom post query with pagination
- Custom Post Fields at the beginning of a Custom Permalink
- Add term to custom post type on draft
- When an unregistered user submits a form for a custom post type, send an email that lets them delete their post
- Multiple tag cloud filtering
- add_rewrite_rule and passing variables for custom post types
- Possible to filter custom post type with multiple meta data?
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- Custom templates for a specific category
- get_page_by_title() doesn’t retrieve my post
- Show all tags on custom post type
- Specifying meta field’s column type in Database using add_post_meta
- show custom value from frontend form in a post (custom post type)
- How to automatic update date and time when save custom post type
- get_the_tag_list() returns bad links
- Filter second dropdown (tax) based on first dropdown (cpt)
- Excluding a Custom Post Type with a specific tag using pre_get_posts
- Merge page with custom post type
- Inefficient Query Confusion
- What is the diference between Post Metadata and Queried Object
- REST filters only firing when I have a param set
- WordPress custom post type and taxonomies
- Search for dates on custom post types
- Convert Custom Table Data Based Plugin To Be Searchable
- Why the_excerpt() function returns excerpt on the Home page and trimmed content in sidebar?
- list posts of two post types in a single template
- Taxonomies exists – but not showing up
- Multiple post types for BuddyBlog plugin [closed]
- Tag template not returning posts [closed]
- Custom Post Type Causes Error: Warning: call_user_func_array()
- “Order” doesn’t work in custom loop?
- Permalink with hierarchy of Custom Post Types
- How do I set a post slug automatically based on taxonomy?
- Get a list of custom post type (property) when clicked on custom taxonomy 1 (rent or sale) from custom taxonomy 2 (city) page
- How to divide Subcategories into pages of parent category wordpress
- Is there any filter to add a custom attribute to the tag in admin panel?
- Display Posts that fit a certain criteria on Category pages
- Custom post type category returns null
- Tell wordpress to show a single page instead of an archive page
- Post display in separate page [duplicate]
- Create dynamic logo carousel without using any plugin
- Delete Post by User
- Only show current category post
- WordPress Contents Migration
- Test for post type in request filter?
- Have two (permalinks) urls for a same custom post type
- If taxonomy show class of active
- Query Posts From Multiple Post Types
- Custom Post Types (Changing post style based on category)
- How to loop through custom posts in admin edit screen
- Notices when submitting custom post type from front-end
- show custom post’s post in two different divs [duplicate]
- querying to custom field over ACF REST API
- Fatal Error WordPress Custom Post Type UI + WPML
- Change post structure
- Permalinks for Custom Post Types and Taxonomies
- Group search results by post type, but having a unique heading for each section?