Support » Fixing WordPress » 404 Error with a custom post type

  • I have done many custom post types in the past, and I’ve dealt with 404 errors before. They’ve always been issues with conflicting names, i.e. the custom post type name is the same as a page name.

    But in this case, there are no conflicting names. I created a custom post type called bids, and I don’t have any other page, category, tag, post, custom taxonomy, etc that are called bids, bid, or anything close.

    Here’s the code I’m using to register the custom post type, which I’ve used dozens of times on other sites just fine:

    $args = array(
    		'labels' => $labels,
    		'public' => true,
    		'publicly_queryable' => true,
    		'show_ui' => true,
    		'show_in_menu' => true,
    		'query_var' => true,
    		'rewrite' => false,
    		'capability_type' => 'post',
    		'has_archive' => true,
    		'hierarchical' => false,
    		'menu_position' => 5,
    		'supports' => array('title','editor','thumbnail')
    	register_post_type('bids', $args);

    I’ve tried setting 'rewrite' => array( 'slug' => 'bid', 'with_front' => false ) and other variations on that, and it doesn’t do anything.

    And yes I’m going to the permalinks page every time to flush those. So far the only thing that works is setting the permalinks to default, or setting rewrite to false.

  • The topic ‘404 Error with a custom post type’ is closed to new replies.