WordPress does not load page.php, return 404.php

To determine if there is something wrong with your server settings or with your theme, you can write a very simple theme that will display different results for the custom post type.

I just tried that with the following theme:

style.css

/**
 * Theme Name: WPSE
 */

functions.php

<?php
function wpse_init() {
  register_post_type( 'wpse', array(
    'labels' => array(
      'name' => 'wpse',
    ),
    'public' => true,
  ) );
}
add_action( 'init', 'wpse_init' );

index.php

<?php
echo 'index';

single-wpse.php

<?php
echo 'single-wpse';

I then created a new wpse custom post type with a slug of ‘test’. When I navigated in a browser to /wpse/test I saw a page that said ‘single-wpse’ as expected.

Note: After switching themes, I needed to refresh the rewrite rules or I saw a 404 on the custom post types.

If you do this and still see a 404, then it’s a server configuration issue. If you see ‘single-wpse’ then it’s something wrong with your theme. I would guess that you are probably using the custom post type label instead of the custom post type slug.