For the main view of items in a custom post type you don’t need to use a page template at all.
Create a file called archive-post_type_name.php
containing the loop for that post type. When you register the post type set the has_archive
value to the URL slug you want the posts to appear on eg. ‘menu’ then browse to http://yoursite.com/menu/ to see the post type archive.
If you don’t want people going to the post type page on its own the simplest way is to just leave out the permalinks in your template.
Related Posts:
- Loading External Scripts in Admin but ONLY for a Specific Post Type?
- How can I remove the “Add New” button in my custom post type?
- Change the edit page for a custom post type?
- Admin Filter – Add Post Type Description on Post Type Page
- how to group custom post types
- How do I filter the excerpt metabox description in admin?
- How to add custom columns to Custom Post Type admin screen
- Is it OK to move admin menu items?
- Hide/Show only specific categories in wp-admin new-post.php
- WordPress Custom Post Type Admin Page really slow
- Custom post type Admin Page
- Post slug changed using code doesn’t reflect on editor when post is published
- WP Admin default view mode for Custom Post Type
- Remove date and category filters when editing custom post types
- Ordering Post 2 Post admin meta box by meta from CPT
- Displaying Post Title on Post Edit page?
- How to programatically set the post title of a CPT on wp-admin
- How to Change the Title of a Meta Box on a Specified Custom Post Type? [duplicate]
- Make a custom column sortable, by custom post count
- Using multiple instances of wp_editor in Custom Post Type admin area
- How i add new link after Edit | Quick Edit | Trash | View in quick edit section
- Custom Post Type Name Causing Problem
- How to add post_author column to custom post type
- Use a textarea for a custom post type
- Restrict categories to a custom post type
- Changing the header on post listing page in admin area
- WordPress User Roles, Custom Post Types, and Admin views
- Adding menu_order to CPT admin page
- Need functionality with all post list available at edit.php
- Show hierarchical relationship between to custom post types on admin list
- Show Custom Post Type values in WordPress grid view
- How to remove ‘create new post’ entry for a custom post type?
- How to make post sticky in the admin page?
- How to customize admin posts based on the user who is logged in
- Change headers in admin posts list
- Admin notice not displaying
- Custom Post Type + 20k posts = blank/404 within Admin edit.php [duplicate]
- Remove rows in the manage post/page view
- Admin not showing all custom post type posts and views not working
- Unable to retrieve any posts of CPT in wp-admin
- Display post meta on edit page in admin
- Modify action buttons for custom post type
- Admin Pointers on a custom post type
- Add a button or image button that calls wp functions in the wp-admin
- Custom admin post.php page
- How to add a custom-post-type post within another custom-post-type post edit screen using AJAX?
- CPT post count is 0 for the authors in the User list
- Possibilities for the edit.php admin panel? [closed]
- Filter hierarchical custom post type admin page by parent, and include children & grandchildren
- Admin Filter – Add Post Type Description on Post Type Page
- Custom post type editor with dynamic selects, one drop down populating a second second drop down not working
- WP-ADMIN – Listing all CPT in “posts” listing
- Custom Postype specific changes in admin panel
- Grouping of CPTs and taxonomies into menu groups in admin
- It’s possible to hide body copy box for a custom post type?
- Show data from one Custom Post Type in another Custom Post Type
- Add a custom text to admin footer in a Custom Post Type page
- Creat new admin url for custom post type
- Custom Field values not Showing in Edit Page of Custom Post Type
- Set thumbnail and title for a post type archive (not post itself!)
- Custom WP_Query doesn’t display all posts
- Copy order items with metadata between orders – Woocommerce
- Change link for “add new” buttons on custom post type
- How do I edit the WordPress post.php file?
- Add data to post edit page, when post is published
- Custom capabilities not reflecting on admin panel
- How to limit what Editors see in the admin?
- Questions regarding add_meta_box()
- Change Post Meta via AJAX from the posts list table
- Custom Attachment Type
- Sorting custom post types in edit.php : Post disappear
- Sort by post word count in admin area
- How to display magic field’s custom write panel in wordpress theme?
- Change ordering of fields of custom post type in admin page
- Admin slow on Postlist (over 30k Posts in Database)
- Hide title field of selected post-types on edit pages
- After inserting new post with wp_insert_post() the post is not visble to WP_Query, but the same WP_Query works for post inserted from wp-admin panel
- Put featured image under post title in admin area
- list articles in admin showing nested categories or slugs?
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- Admin Post Table – Remove Title Edit Link
- Add Custom Field in Product in WP Admin and send to Order Webhook
- Publishing failed. The response is not a valid JSON response
- How do I create a customised table list of a custom post type (in the admin area)?
- Restrict Custom Post Type to One Item
- How to redirect from wp-admin/edit.php to a frontend page for specific custom post type?
- exclude admin archive edit screen
- Simple Data picker meta box
- In the admin, how can you list thumbnails instead of titles for a custom post type?
- Custom post meta box as a sub form
- Add filter button to custom post type in admin area
- “Trash”, “Draft” and count not showing for custom post type in admin panel
- Edit is changing my custom’s post type parent id
- Change the text on the Publish button
- Show a custom field instead of username in the backend author area
- Can’t preview custom post – Redirected to home page
- How to make an admin create/edit post page to look like taxonomy page?
- Show posts of parent in edit.php
- admin search of pages returns custom post types
- Custom order of CPT posts by title, in wp-admin area by default