Wordpress - Custom post type single page returns 404 error

You should set your publicly_queryable argument to true when registering your custom post type.

TAKE NOTE: Add flush_rewrite_rules(), refresh the page once or twice and REMOVE IT IMMEDIATELY. You SHOULD NOT keep flush_rewrite_rules() unless under the provisions as in the codex.

this is an expensive operation so it should only be used when absolutely necessary


Flush the rewrite rule from dashboard -> Settings->Permalink page. Click on save button and then check your slide details page. It will work now. Otherwise you can write this code flush_rewrite_rules() in your create_slide_post_type() function. See the Codex


Refresh your permalinks. Go to Admin->Settings->Permalinks and hit Save. It refreshes your permalinks and should help, especially if you are changing rewrite ( 'rewrite' => array( 'slug' => 'slide' ),)