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.

Have a snippet here that doesn't seem to show up the taxonomy in the CPT edit screen. Not sure what's wrong, both the taxonomy and CPT are registered to each other.

<?php
add_action('init', 'create_taxonomy');

function create_taxonomy() {
    register_taxonomy( 'farm', array('farmer', 'food', 'recipe'), array(
        'label'                                 => 'farms',
        'public'                                => true,
        'show_ui'                               => true,
        'show_in_nav_menus'                     => true,
        'show_tagcloud'                     => true,
        'hierarchical'                          => true,
        'show_admin_column'                     => true,
        'query_var'                         => 'farm',
        'update_count_callback' => '',
        'sort'                                  => true,
        'labels'                                => array(
            'name'                                              => __('Farms'),
            'singular_name'             => __('Farm'),
            'menu_name'                                     => __('Farm'),
            'all_items'                                     => __('All Farms'),
            'edit_item'                                     => __('Edit Farm'),
            'view_item'                                     => __('View Farm'),
            'update_item'                                   => __('Update Farm'),
            'add_new_item'                              => __('Add New Farm'),
            'new_item_name'                             => __('New Farm'),
            'search_items'                              => __('Search Farms'),
            'popular_items'                             => __('Popular Farms'),
            'separate_items_with_commas'    => __('Separate farms by commas'),
            'add_or_remove_items'                   => __('Add or remove farms'),
            'choose_from_most_used'             => __('Choose from the most popular farms'),
            'not_found'                                     => __('No farms found')
        ),
        'rewrite'                               => array(
            'slug'                  => 'farm',
            'with_front'        => false,
            'hierarchical'  => false,
        )
    ) );

    register_post_type( 'farmer', array(
        'public'                    => true,
        'taxonomies'            => array( 'farm' ),
        'menu_position'     => 6,
        'capability_type'   => 'page',
        'rewrite'                   => array( 'slug' => 'farmer' ),
        'supports'              => array( 'title', 'editor', 'thumbnail', 'custom-fields' ),
        'labels'                    => array(
        'name'                              => __('Farmers'),
        'menu_name'                     => __('Farmers'),
        'singular_name'             => __('Farmer'),
        'add_new'                           => __('Add New'),
        'add_new_item'              => __('Add New Farmer'),
        'edit_item'                     => __('Edit Farmer'),
        'new_item'                      => __('New Farmer'),
        'all_items'                     => __('All Farmers'),
        'view_item'                     => __('View Farmer'),
        'search_items'              => __('Search Farmers'),
        'not_found'                     => __('No farmers found'),
        'not_found_in_trash'    => __('No farmers found in Trash')
        )
    ) );}
?>
share|improve this question

1 Answer 1

I've tried your code WordPress 3.5.1 installation, and it works just fine.

Check the WordPress version you are using and the changelog to find out if something that can interfere with your CPT and taxonomy is different in your version than in 3.5.1

share|improve this answer
    
I am using 3.5.1 as well. –  Angela Apr 9 '13 at 8:37
    
Try flushing the permalinks or use the recommended codex.wordpress.org/Function_Reference/… after both custom post type and taxonomy have been registered –  Alex Markus Apr 9 '13 at 8:49
    
Done...not sure what's wrong, but I rewrote the code and it seems to be working...Guess WP is having a bad day once in a while... –  Angela May 11 '13 at 3:33

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.