Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I created a custom post type ("Portfolio") and I can create the posts perfectly fine. The problem is when I go to view the item, it gives me a 404 error.

Here is the portfolio item

Here is my code registering the custom post type:

add_action( 'init', 'create_post_type' );
  function create_post_type() {
    $labels = array(
        'name' => __('Portfolio'),
        'singular_name' => __('Portfolio Item'),
        'add_new' => __('Add New'),
        'add_new_item' => __('Add New Portfolio Item'),
        'edit_item' => __('Edit Portfolio Item'),
        'new_item' => __('New Portfolio Item'),
        'view_item' => __('View Portfolio Item'),
        'search_items' => __('Search Portfolio'),
        'not_found' =>  __('Nothing found'),
        'not_found_in_trash' => __('Nothing found in Trash'),
        'parent_item_colon' => ''
    );

    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        'menu_icon' => null,
        'rewrite' => true,
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => null,
        'supports' => array('title','editor','thumbnail','excerpt','comments')
    );
    register_post_type( 'portfolio' , $args );      
}

I'm missing something but I don't know what. Help! Thanks in advance :)

share|improve this question
    
this happens with a running site... try resseting your permalink struture, save and then reset to your needs. –  Sagive SEO Sep 9 '13 at 11:46
    
That worked! Thanks very much for your help! –  Tara Sep 9 '13 at 11:49

2 Answers 2

up vote 2 down vote accepted

Do the following things and try.

  1. Flush rewrite rules.(Check the link enter link description here).
  2. Update your permalink.
share|improve this answer

Try to regenerate your permalinks.

Go to Settings / Permalinks and click the Save button.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.