I have a custom post type and I can't access the archive page for it. When I try to it redirects me to the home page. I don't have any taxonomy for it. I have setup an archive-post-type.php template for it though.
I can access the individual posts in that post type.
I've re-saved my permalinks, deleted my htaccess file and resaved my permalinks again. Still redirects. Any ideas?
UPDATE: It's working when I try it in another browser, but Chrome continues to redirect. Cleared my cache, but it's still happening.
Here is my code for my custom post type.
register_post_type(
'featured-grants',
array(
'description' => '',
'public' => true,
'publicly_queryable' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'exclude_from_search' => false,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 6,
'menu_icon' => 'dashicons-awards',
'can_export' => true,
'delete_with_user' => false,
'hierarchical' => false,
'has_archive' => true,
'query_var' => true,
'capability_type' => 'page',
'map_meta_cap' => true,
/* The rewrite handles the URL structure. */
'rewrite' => array(
'slug' => 'featured-grants',
'with_front' => true,
'pages' => true,
'feeds' => true,
'ep_mask' => EP_PERMALINK,
),
/* What features the post type supports. */
'supports' => array(
'title',
'editor',
'thumbnail'
),
/* Labels used when displaying the posts. */
'labels' => array(
'name' => __( 'Featured Grants', 'featured-grants' ),
'singular_name' => __( 'Featured Grant', 'featured-grants' ),
'menu_name' => __( 'Featured Grants', 'featured-grants' ),
'name_admin_bar' => __( 'Featured Grants', 'featured-grants' ),
'add_new' => __( 'Add New', 'featured-grants' ),
'add_new_item' => __( 'Add New Featured Grant', 'featured-grants' ),
'edit_item' => __( 'Edit Featured Grant', 'featured-grants' ),
'new_item' => __( 'New Featured Grant', 'featured-grants' ),
'view_item' => __( 'View Featured Grant', 'featured-grants' ),
'search_items' => __( 'Search Featured Grants', 'featured-grants' ),
'not_found' => __( 'No featured grants found', 'featured-grants' ),
'not_found_in_trash' => __( 'No featured grants found in trash', 'featured-grants' ),
'all_items' => __( 'Featured Grants', 'featured-grants' ),
)
)
);
I have a custom post type and I can't access the archive page for it. When I try to it redirects me to the home page. I don't have any taxonomy for it. I have setup an archive-post-type.php template for it though.
I can access the individual posts in that post type.
I've re-saved my permalinks, deleted my htaccess file and resaved my permalinks again. Still redirects. Any ideas?
UPDATE: It's working when I try it in another browser, but Chrome continues to redirect. Cleared my cache, but it's still happening.
Here is my code for my custom post type.
register_post_type(
'featured-grants',
array(
'description' => '',
'public' => true,
'publicly_queryable' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'exclude_from_search' => false,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 6,
'menu_icon' => 'dashicons-awards',
'can_export' => true,
'delete_with_user' => false,
'hierarchical' => false,
'has_archive' => true,
'query_var' => true,
'capability_type' => 'page',
'map_meta_cap' => true,
/* The rewrite handles the URL structure. */
'rewrite' => array(
'slug' => 'featured-grants',
'with_front' => true,
'pages' => true,
'feeds' => true,
'ep_mask' => EP_PERMALINK,
),
/* What features the post type supports. */
'supports' => array(
'title',
'editor',
'thumbnail'
),
/* Labels used when displaying the posts. */
'labels' => array(
'name' => __( 'Featured Grants', 'featured-grants' ),
'singular_name' => __( 'Featured Grant', 'featured-grants' ),
'menu_name' => __( 'Featured Grants', 'featured-grants' ),
'name_admin_bar' => __( 'Featured Grants', 'featured-grants' ),
'add_new' => __( 'Add New', 'featured-grants' ),
'add_new_item' => __( 'Add New Featured Grant', 'featured-grants' ),
'edit_item' => __( 'Edit Featured Grant', 'featured-grants' ),
'new_item' => __( 'New Featured Grant', 'featured-grants' ),
'view_item' => __( 'View Featured Grant', 'featured-grants' ),
'search_items' => __( 'Search Featured Grants', 'featured-grants' ),
'not_found' => __( 'No featured grants found', 'featured-grants' ),
'not_found_in_trash' => __( 'No featured grants found in trash', 'featured-grants' ),
'all_items' => __( 'Featured Grants', 'featured-grants' ),
)
)
);
Share
Improve this question
edited Jan 3, 2018 at 17:55
paper_robots
asked Jan 3, 2018 at 17:36
paper_robotspaper_robots
5251 gold badge8 silver badges20 bronze badges
4
- What URL are you attempting to visit as the archive page? Can you view individual posts in this post type, if so, what is the URL structure? – jdm2112 Commented Jan 3, 2018 at 17:38
- @jdm2112 I'm accessing at /featured-grants . I can access the individual posts in it. They are at /featured-grants/post-name – paper_robots Commented Jan 3, 2018 at 17:40
- What action are you hooked to when you register your post type? – jdm2112 Commented Jan 3, 2018 at 17:48
- @jdm2112 So it's working, but just not in chrome. – paper_robots Commented Jan 3, 2018 at 17:56
1 Answer
Reset to default 1Fixed the issue, cleared cache in chrome multiple times and closed it.