I've created custom post types in a theme before (actually on the exact theme I'm having trouble with now), and everything has gone relatively seamlessly. However, now I've run into an issue where a post type that I'm trying to create, with archive and content php files, is not working. More specifically, the slug is not working.
function sop_posttype() {
register_post_type( 'sop',
array(
'labels' => array(
'name' => __( 'SOPs' ),
'singular_name' => __( 'SOP' )
),
'slug' => 'sop',
'menu_icon' => 'dashicons-editor-help',
'public' => true,
'has_archive' => true,
'supports' => [ 'title', 'editor', 'thumbnail' ]
)
);
}
add_action( 'init', 'sop_posttype' );
Above is my registration for the post type. It is almost exactly the same as my previous post type, only with a different name.
My archive file is called archive-sop.php, and my content file is called content-sop.php.
I can't seem to see anything missing in my registration code, and the other post types are working correctly, but for some reason I'm still getting a 404 when I try to visit the archive page (http://url.com/sop/), even though I've added a test post.
rewrite
parameter ofregister_post_type()