Well, there is another way. And better, I guess.
You should look at register_post_type
parameters. You should probably set them like this:
'public' => false, // it's not public, it shouldn't have it's own permalink, and so on
'publicly_queryable' => true, // you should be able to query it
'show_ui' => true, // you should be able to edit it in wp-admin
'exclude_from_search' => true, // you should exclude it from search results
'show_in_nav_menus' => false, // you shouldn't be able to add it to menus
'has_archive' => false, // it shouldn't have archive page
'rewrite' => false, // it shouldn't have rewrite rules
If post type is not public, then you won’t see this part of editor.
Related Posts:
- How to change “Draft” string for status of custom post type to “Unavailable”?
- How to correctly get post type in a the_title filter
- post_type_link filter causes 404 on the CPT page it’s used on
- Make the ‘all’ filter default instead of ‘mine’ in a custom post type
- What is better: Custom Fields vs Custom Taxonomies with Terms for perfomance, scalability and better user experience
- Remove “Get Shortlink” button in admin of custom post type
- How to get Custom Post ID by adding filter to child theme’s function
- Custom Taxonomy breaking pages permalinks
- Add html to cpt main page / admin edit.php
- register_taxonomy and register_post_type does not work [closed]
- Displaying custom taxonomy in the admin list of a custom post type
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- Filter Posts from the Main Query
- Create new custom post and post category of same name
- how to retain the ability to modify the post slug after applying a post_type_link filter?
- Custom Permalink For Custom Post Type – Working Fine But Broken For Pagination
- Post Click Redirect to Custom URL instead of Single Post Page
- Keep br tags from stripping
- Filter wp_dropdown_categories Per Post Type
- What is the proper way implement a global $wp_rewrite?
- When Attempting to Filter Plugin Generated Content Using Filter post_type_link, Permalinks Are Not Modified
- Permalinks: custom post type -> custom taxonomy -> post
- Mixing custom post type and taxonomy rewrite structures?
- Resolve a custom post type name vs. page permalink conflict (same slug)
- Nested custom post types with permalinks
- How do I append multiple taxonomies to the URL?
- Custom rewrite rules for archive page and single post
- WordPress Rewrite Rules for Custom Post Type and Taxonomy
- Custom post type 404s with rewriting even after resetting permalinks
- Rewrite rule for Custom post type Monthly and Yearly archive
- Numeric slug on child post
- How to add a CSS class to every image in a Custom Post Type
- Having a custom post slug that clashes with an existing directory
- Help with a TV series Rewrite structure
- Remove Slug from Custom Post Type results in 404
- single-type.php not working, delivering 404
- How does one flush rules on theme activation or deactivation only?
- Page to display an archive of taxonomies
- Help with issues on “Adding a Taxonomy Filter to Admin List for a Custom Post Type?”
- How to create a permalink for custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name
- Date-based permalinks for Custom Post Type, and custom taxonomy permalinks
- WordPress rewrite my URL when i use pagination
- Modifying date filter on admin page for custom post type to link to custom field
- Parent & Child Taxonomy slugs in custom post permalink
- Easy way to change custom post type name for permalinks?
- Append date to custom post type url slug
- Use menus with anchors
- Permalink structure by Post Meta value
- custom post type parsed as attachment
- 404 Issue w/ Custom Post Type – using Meta for Permalink rewrite
- WordPress Custom Post Type Permalinks dynamic term slugs
- How can I made custom taxonomies relationship?
- How to add rewrite rule to custom post type with parent in url with cpt ui?
- WooCommerce sort products by the actual product width(not the shipping width)
- Create a custom php page and load it at a specific slug
- Permalinks /country/city/cpt/postname/
- Seamless permalinks between Custom Taxonomy and Custom Posts
- Custom post type and custom taxonomy with the same slug using the file page taxonomy only as directory
- Path to custom post type
- Make custom post types and pages place nice, re: rewrite
- Use remove_meta_box conditionally on custom post type
- Permalink problems with custom post type and custom taxonomy
- How do I add custom HTML to the content of an archive page’s posts?
- Only show posts with a specific term of an associated taxonomy in a custom post type archive
- Custom Post Type Advanced Slug
- Filtering the_content, but still need to display the unfiltered content inside filter
- Under What Conditions Can I name my CPT the same as my CPT Page?
- Adding /blog in front of single posts (only)
- How to remove /blog/ prefix for custom post types in permalinks?
- custom filtering admin columns
- Query filter by value in meta_value array
- On saving Post My permalink is updated and category is removed automatically which cause the 404
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- Edit the default ‘post’ custom post type arguments
- add all blog posts to folder
- Category permalinks don’t work even after flushing
- Changing permalink of default Post with custom post
- Custom Taxonomy Archive generates 404
- Enabling hierarchical in a Custom Post Type gives error 404
- How to create a permalink structure with custom taxonomies and custom post types
- Permalinks change when edit published post on custom post type
- Custom permalink rewrite rules – how do I fix this?
- How to retrieve custom post type permalink in another cpt?
- Post Custom & Taxonomy 404 error
- Dropdown switching subcategories portfolio
- Custom post type with parent page? Possible?
- Hierarchical taxonomy in permalink structure
- Filter custom post type by tags
- Custom Search Template for Custom Post Types
- Can’t make permalink of CPT work
- Issue with permalinks for custom post type
- Adding rewrite rules to Custom Post-type mixed with Taxonomy
- “regular” pages not found after changing permalink
- Custom Post Type and Taxonomy pagination permalink
- Linking from a list of custom post type items to a single – get_post_permalink not working correctly
- Custom post type permalink structure
- How do I use CPT and permalinks with a mobile theme?
- Rewrite a filter as shortcode (or something like that) to use anywhere in CPT
- add_filter > posts_where works partially
- Can I have a specific template for products even if they are standard posts and not CPT?