I have custom post type for wordpress.
http://localhost/wordpress/photos/
http://localhost/wordpress/photos/my-photo
Why these url return 404 not found ?
How can I make a archive file for this ?
like :
archive-photos.php ( I have this in directory, but …)
function register_gallery(){
register_post_type( 'photos', array(
'public' => true,
'menu_position' => 10,
'menu_icon' => 'dashicons-format-gallery',
'supports' => array( 'title', 'editor', 'thumbnail'),
'has_archive' => true,
));
}
add_action('init','register_gallery');
You have to use,
also try, settings->permalinks save all settings.
more info visit, https://codex.wordpress.org/Function_Reference/register_post_type
I found another solution, it can be done on 404 page when navigating through archives on custom post type(CPT):