Reply To: 404 page not found

Hi Feryaz,
I’ve pinpointed the problem at the theme’s side, and have already offered a fix for my client.

The theme has a custom post type, ‘room’ which was registered as such:

add_action('init', 'ci_create_cpt_room');
function ci_create_cpt_room()
{
$labels = array(
'name' => _x('Rooms', 'post type general name', CI_DOMAIN),
// etc
);

$args = array(
'labels' => $labels,
'singular_label' => __('Room', CI_DOMAIN),
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => false,
'has_archive' => true,
'rewrite' => true,
'menu_position' => 5,
'supports' => array('title', 'editor', 'thumbnail')
);

register_post_type( 'room' , $args );
}

The 404 was fixed by changing the hook from ‘init’ to ‘setup_theme’.
The thing is, I can’t really understand why it happens in the first place.
In fact, any hook after ‘setup_theme’ results in the plugin/theme combo to give a 404 on form submit.
Hooks before ‘setup_theme’ give mixed results, i.e.:
‘muplugins_loaded’ works.
‘registered_taxonomy’ gives the 404 problem.
‘registered_post_type’ makes WordPress not load at all.
‘plugins_loaded’ works

The weird thing is that we have another custom post type, ‘slider’ which is again, registered during the ‘init’ hooks and works flawlessly, and since the plugin doesn’t interfere with the room post type, I can’t think of a reason why it would break.

Any thoughts?