You’re missing this in your code and the names of your template hierachy seems to be wrong.
page-cpt.php relates to a page template and not a CPT archive.
'rewrite' => array( 'slug' => 'top-ten-list', 'with_front' => false ),
Assuming you use the slug top-ten-list
You should name your archive template archive-top-ten-list.php
You should name your single CPT template single-top-ten-list.php
Here’s an example of all the correct code which is tested and works you can use as a guide
No need to add flush_rewrite_rules(); as you can simply re-save your Permalinks.
You could also use dashicons rather than adding an image for your menu icon.
You may also consider adding custom taxonomy types which enable you to create categories for your CPT.
Related Posts:
- Change “Enter Title Here” help text on a custom post type
- How do you use orderby with meta_query in WordPress 3.1?
- Remove Custom Taxonomy Metabox from Custom Post Type Screen
- Linking Two Post Types
- How can I change the admin search posts fields?
- Creating conditional blocks for WordPress Gutenberg
- Random post, once per day
- Prevent Google from indexing custom post types?
- How to display regular posts & custom post types that fall under a category using just the generic category template?
- Remove Trash / Delete option for Custom Post Type / Taxonomy
- How to filter custom post types by custom category taxonomy
- expire wordpress user posts
- Removing base slug from hierarchical custom post type
- Querying custom posts and regular posts
- WP_Query to loop a Custom Field, Custom Post Types do not show
- sort events based on event date custom field
- Getting arguments for register_post_type from a plugin generated post type
- How can I get the last posts by user role?
- Limit taxonomy results to a single cpt
- Redirect to post with only post ID in the URL vs post_type/post ID
- Custom-post-type-archive: posts sorted/filtered by year?
- Relationship between two taxonomies and a custom post type [closed]
- Sharing a custom taxonomy with Multiple custom post types
- How to remove ‘create new post’ entry for a custom post type?
- Show Two custom Post type and their posts on category page
- WordPress nl2br is not converting newline to html line break when saving metabox value
- Change Permalink Structure for Tag.php template
- Metadata for a taxonomy – is there any WordPress way of doing this?
- Remove post type slug of all post types from permalinks
- Calculate all custom field values in the post loop
- Custom page sidebar using Template dropdown box
- Role scoping for contributors down to the field level
- I would like to have different styles for my posts based on the content of each post
- Separate custom categories from default category
- Converting the_content string to an array?
- Rewrite post type slug only for child theme
- How can I make the slug of the taxonomy also the slug of the custom post
- Assign same parrent Page to pages AND custom post types
- How do I display the grand child items of a taxonomy term?
- Top Level pages in wordpress giving 404, but child pages working fine
- Query posts with double taxonomy
- CPT category hierarchy
- How To Import CPT With Only Few TEXT ACF Fields From Front End?
- Get only used meta_values
- wordpress remove views from action links in a custom post
- Getting 400 Bad Request on AJAX Call
- Remove Quick edit for custom post type?
- WordPress custom slug rewrite
- How do I create an overview page with custom calculations from a post-type?
- Creating two loops based on different logic
- Plugin or method of allowing user to rearrange custom post types with drag and drop?
- Add to ‘action’ within post.php to allow more actions when editing a Custom Post Type in a plugin
- Archive links for custom post types
- Query entries from custom post type in an ACF flexible content field
- How to copy a custom field from the user’s CPT to the user’s normal posts
- Different videos for different posts
- Related posts meta_query CPT
- Change Post Meta via AJAX from the posts list table
- Catch and display error on save_post action
- How to create Custom image post?
- Weird issue where form field loses focus to previous form field even with JS disabled
- posts_per_page in custom WP_Query does not override “Reading” settings?
- How to store the third party script with HTML code in the wordpress custom input field?
- Display Parent-Child Posts in specific order by comparing IDs in array
- How to display related posts using the same taxonomy for custom types (WordPress, Pods, Woo)
- How to make post title to appear after an image?
- Adding featured image to a new post using front-end form?
- Pagination on custom post type without plugin
- How can I check the rewrite slug of current post type listing page
- Static Front Page not working for custom theme
- Is there a way to create a sidebar of bullets
- post_type incorrect for custom post type
- How to configure the output of breadcrumbled CPT UI
- Live search by custom tag
- Set a Default CPT taxonomy by taxonomy id
- Skip latest 3 posts from loop
- how to create custom taxonomy drop downs for parents and child
- Correct way to register custom post type from external php file?
- How to redirect from wp-admin/edit.php to a frontend page for specific custom post type?
- How to get the posts that my following users are liked?
- How to insert post 6 times after user register like ask.fm
- Only show categories that have posts within custom post type
- Not Able to List CPT Based on Taxonomy Term
- Duplicate Custom Post Type
- Insert custom post type via XML-RPC?
- CPT or Custom Table for Repository of Serial Numbers
- How to Fix Custom WordPress Loop with Pagination on Single Post View?
- Best way to group posts based on custom post type terms
- How to remove UI access to Custom Post Type using direct links?
- get_post_types doesn’t work in plugin
- Would like to add a “leaderboard” (custom field) to a custom post type
- Using $seed on a custom post type for randomly displayed posts
- I have a custom post type that I want to query a dynamic category name from a custom meta field
- Can’t open Custom Post Types Link in navigation
- Remove custom taxonomy ‘post-type’ from post URL
- Problem with a query in custom posts
- Custom post-type’s pagination not working in category.php
- Using custom post types within a section of a template
- Pulling in a particular post into a single page based on the post id passed into the code
- using a template for more then 1 page