- This topic has 9 replies, 4 voices, and was last updated 5 years, 1 month ago by
Tom.
-
AuthorPosts
-
March 31, 2021 at 1:37 am #1716281
Samuel
I have created a custom post-type which name is Portfolio. After creating a post-type I updated Permalink. But When I am going to a custom post-type archive page or single page it’s showing a 404 error.
This is the archive page: https://dc1.justcreative.com/portfolio-item/
This is the single page: https://dc1.justcreative.com/portfolio-item/primitive/Here is the custom post type code:
function jc_portfolio_post_type() { $labels = array( 'name' => _x( 'Portfolio', 'Post Type General Name', 'jc' ), 'singular_name' => _x( 'Portfolio', 'Post Type Singular Name', 'jc' ), 'menu_name' => __( 'Portfolio', 'jc' ), 'name_admin_bar' => __( 'Portfolio', 'jc' ), 'archives' => __( 'Item Archives', 'jc' ), 'attributes' => __( 'Item Attributes', 'jc' ), 'parent_item_colon' => __( 'Parent Item:', 'jc' ), 'all_items' => __( 'All Items', 'jc' ), 'add_new_item' => __( 'Add New Item', 'jc' ), 'add_new' => __( 'Add New', 'jc' ), 'new_item' => __( 'New Item', 'jc' ), 'edit_item' => __( 'Edit Item', 'jc' ), 'update_item' => __( 'Update Item', 'jc' ), 'view_item' => __( 'View Item', 'jc' ), 'view_items' => __( 'View Items', 'jc' ), 'search_items' => __( 'Search Item', 'jc' ), 'not_found' => __( 'Not found', 'jc' ), 'not_found_in_trash' => __( 'Not found in Trash', 'jc' ), 'featured_image' => __( 'Featured Image', 'jc' ), 'set_featured_image' => __( 'Set featured image', 'jc' ), 'remove_featured_image' => __( 'Remove featured image', 'jc' ), 'use_featured_image' => __( 'Use as featured image', 'jc' ), 'insert_into_item' => __( 'Insert into item', 'jc' ), 'uploaded_to_this_item' => __( 'Uploaded to this item', 'jc' ), 'items_list' => __( 'Items list', 'jc' ), 'items_list_navigation' => __( 'Items list navigation', 'jc' ), 'filter_items_list' => __( 'Filter items list', 'jc' ), ); $rewrite = array( 'slug' => 'portfolio-item', 'with_front' => true, 'pages' => true, 'feeds' => true, ); $args = array( 'label' => __( 'Portfolio', 'jc' ), 'description' => __( 'Post Type Description', 'jc' ), 'labels' => $labels, 'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ), 'taxonomies' => array( 'portfolio_filter' ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 5, 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'rewrite' => $rewrite, 'capability_type' => 'page', ); register_post_type( 'portfolio', $args ); } add_action( 'init', 'jc_portfolio_post_type', 0 );March 31, 2021 at 3:28 am #1716347David
StaffCustomer SupportHi there,
have you created the associated templates ( in a child theme ) for your CPT ?
Here’s a basic example:
https://docs.generatepress.com/article/setting-up-a-simple-custom-post-type/
March 31, 2021 at 6:08 am #1716492Samuel
Yes, I have created associated templates in Child Theme.
April 1, 2021 at 1:45 am #1717523David
StaffCustomer SupportHave you checked your permalink settings ?
April 1, 2021 at 9:01 am #1718158Samuel
My permalink has ok. Please, check this image
April 1, 2021 at 3:23 pm #1718443Elvin
StaffCustomer SupportCan you try changing the common settings to this?:
https://share.getcloudapp.com/yAuDo5j2April 3, 2021 at 5:47 am #1719932Samuel
Yes, I have cleared Cache from website.
Right now my custom post type slug is portfolio-item. When I am using a prefix with slug (such as new-portfolio-item) then custom post-type Archive & Single Page both page working fine.
Problem just on this slug name portfolio-item.
April 4, 2021 at 3:56 am #1720767David
StaffCustomer Supportdoes your slug and cpt template names match ?
April 5, 2021 at 12:11 am #1721627Samuel
Yes, the template name match with CPT.
April 5, 2021 at 10:58 am #1722403Tom
Lead DeveloperLead DeveloperStrange that changing the slug makes it work. Maybe you have a conflicting plugin with the
portfolio-itemslug? -
AuthorPosts
- You must be logged in to reply to this topic.