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'm having some issues here. Im trying to create a custom post type (acessorio) and some categories for it (acessorios_categories). So, what happens is that none of both works. Gives me 404 in both cases.

Alterady tried to flush the htaccess. Creating single-acessorio.php too. Dont work.

Here's my code:

        add_action('init', 'register_acessorios');
        function register_acessorios() {
        register_post_type('acessorio',
                  array(     'labels' => array(
                                'name' => 'Acessórios',
                                'singular_name' => 'Acessório',
                                'menu_name' => 'Acessórios',
                                'all_items' => 'Todos os Acessórios',
                                'add_new' => 'Adicionar Novo',
                                'add_new_item' => 'Adicionar Novo Acessório',
                                'edit_item' => 'Editar Acessório',
                                'new_item' => 'Novo Acessório',
                                'view_item' => 'Ver Página do Acessório',
                                'search_items' => 'Buscar Acessórios',
                            ),
                            'public' => true,
                            'show_ui' => true,
                            'exclude_from_search' => false,
                            'query_var' => true,
                            'show_in_menu' => true,
                            'capability_type' => 'post',
                            'hierarchical' => false,
                            'publicly_queryable' => true,
                            'has_archive' => false,
                            'supports' => array('title','editor','thumbnail',),
                            'taxonomies' => array('acessorios_categories',),
                            'menu_position' => 5,
                            ) );
        }


        function add_acessorios_tax() {
             // Add new "Locations" taxonomy to Posts
             register_taxonomy('acessorios_categories', 'post', array(
                  // Hierarchical taxonomy (like categories)
                  'hierarchical' => true,
                  // This array of options controls the labels displayed in the WordPress Admin UI
                  'labels' => array(
                       'name' => _x( 'Categorias', 'taxonomy general name' ),
                       'singular_name' => _x( 'Categoria', 'taxonomy singular name' ),
                       'search_items' =>  __( 'Buscar Categorias' ),
                       'all_items' => __( 'Todas as Categorias' ),
                       'parent_item' => __( 'Categoria Pai' ),
                       'parent_item_colon' => __( 'Categoria Pai:' ),
                       'edit_item' => __( 'Editar Categoria' ),
                       'update_item' => __( 'Atualizar Categoria' ),
                       'add_new_item' => __( 'Adicionar Categoria' ),
                       'new_item_name' => __( 'Nova Categoria' ),
                       'menu_name' => __( 'Categorias' ),
                  ),
                  // Control the slugs used for this taxonomy
                  'rewrite' => array(
                       'slug' => 'acessorios', // This controls the base slug that will display before each term
                       'with_front' => true, // Don't display the category base before "/locations/"
                  ),
             ));
        }
        add_action( 'init', 'add_acessorios_tax', 0 );

        flush_rewrite_rules( false );

Thanks for any help!

share|improve this question
1  
Try re-saving permalink structure. –  Vinod Dalvi Apr 12 '13 at 4:16
    
Already tried. Is there anyway to clear the taxonomies from wordpress to try cleary again? –  Lucas Veiga Apr 12 '13 at 12:55

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.