Support » Fixing WordPress » custom post type single post issue

  • Resolved Jim Bouton


    I am editing a theme that uses a custom post type that works fine but when I try to view the single post it returns “page not found”.

    I named the single “single-jj_projects.php” as the codex suggests but have had no joy.

    add_action( 'init', 'create_post_type_projects' );
        function create_post_type_projects() {
        register_post_type( 'jj_projects',
    	'labels' => array(
    	'name' => __( 'Projects' ),
    	'singular_name' => __( 'Projects' )
    	'hierarchical' => true,
    	'public' => true,
    	'has_archive' => true,
    	'show_in_menu' => true,
    	'menu_position' => 5,
    	'supports' => array( 'title', 'thumbnail', 'editor', 'excerpt'),
    	'show_ui' => true,
Viewing 3 replies - 1 through 3 (of 3 total)
  • Have you flushed your rewrite rules? Either by code or manually?

    If not, go to your permalinks settings page and just hit save – then test

    That worked perfectly, thanks for your help.

    No problem, gotta flush the rules whenever you establish a post type or a taxonomy.

    It can be done in the code (I believe the CPT section of the codex has examples), but if you aren’t creating these often, what you did above is only required when creating anything new – and that is often sufficient.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘custom post type single post issue’ is closed to new replies.