• Resolved marcelobm

    (@marcelobm)


    Hi everyone, I’m working on this website and I’m running into some issues with custom taxonomies and posts, the thing is that in the local host everything appear where expected but online suddenly the custom taxonomies doesn’t appear in the custom menus to add it as a menu item, this is the taxonomy definition I’m using on the function.php on my template

    register_taxonomy(	'Page Category',
    						array('page'),
    						array(
    							'public'=>true,
    							'hierarchical' => true,
    							'labels'=>array(
    										'name'				=>__('Page Categories'),
    										'singular_name'		=>__('Page Category'),
    										'search_items'		=>__('Search Page Categories'),
    										'popular_items'		=>__('Popular Page Categories'),
    										'all_items'			=>__('All Page Categories'),
    										'parent_item' 		=>__( 'Parent Page Category' ),
    										'parent_item_colon' =>__( 'Parent Page Category:' ),
    										'edit_item' 		=>__( 'Edit Page Category' ),
    										'update_item' 		=>__( 'Update Page Category' ),
    										'add_new_item' 		=>__( 'Add New Page Category' ),
    										'new_item_name' 	=>__( 'New Page Category Name' ),
    
    										),
    							'query_var'=>'page_categories',
    							'rewrite' => array( 'slug' => 'page_categories', 'with_front' => false ),
    							'show_ui' => true,
    
    							)
    						);

    I really appreciate if anyone can help me with this issue. thanks in advance

Viewing 15 replies - 1 through 15 (of 17 total)
  • Remove the comma on the end here.

    'show_ui' => true,

    The last item of an array should not have a comma after.

    Thread Starter marcelobm

    (@marcelobm)

    Ok, I did it but still not showing up in the custom menu section, what is weird is that in the localhost works fine but online doesn’t.

    Any one else have any Idea how to fix this?

    <?php
    register_taxonomy(
    'Page Category',
    array('page'),
    array(
    	'public'=>true,
    	'hierarchical' => true,
    	'labels'=>array(
              				'name'				=>__('Page Categories'),
              				'singular_name'		=>__('Page Category'),
              				'search_items'		=>__('Search Page Categories'),
              				'popular_items'		=>__('Popular Page Categories'),
              				'all_items'			=>__('All Page Categories'),
              				'parent_item' 		=>__( 'Parent Page Category' ),
              				'parent_item_colon' =>__( 'Parent Page Category:' ),
              				'edit_item' 		=>__( 'Edit Page Category' ),
              				'update_item' 		=>__( 'Update Page Category' ),
              				'add_new_item' 		=>__( 'Add New Page Category' ),
              				'new_item_name' 	=>__( 'New Page Category Name' )
    				          ),
    	'query_var' => 'page_categories',
    	'show_ui' => true,
    	'rewrite' => array( 'slug' => 'page_categories', 'with_front' => false ),
    	));
    ?>

    Try this once.

    Thread Starter marcelobm

    (@marcelobm)

    thank you for your reply but didn’t work.

    Any other ideas?

    Where are you putting this code and is it inside a function?

    Taxonomies or post types need to be registered at init, i see no such action in your above code, can you clarify how/where you’re using this code please.

    @chinmoy: You’ve made a slight error in your code, there’s a stray comma after the end item of one of the arrays.. ??

    hey marcelobm its work for me. Page category created under admin > pages tab. Try this and check once. Put this code in themes functions.php file.

    register_taxonomy(
    'Page Category',
    'page',
    array(
    	'public'=>true,
    	'hierarchical' => true,
    	'labels'=>array(
              				'name'				=>__('Page Categories'),
              				'singular_name'		=>__('Page Category'),
              				'search_items'		=>__('Search Page Categories'),
              				'popular_items'		=>__('Popular Page Categories'),
              				'all_items'			=>__('All Page Categories'),
              				'parent_item' 		=>__( 'Parent Page Category' ),
              				'parent_item_colon' =>__( 'Parent Page Category:' ),
              				'edit_item' 		=>__( 'Edit Page Category' ),
              				'update_item' 		=>__( 'Update Page Category' ),
              				'add_new_item' 		=>__( 'Add New Page Category' ),
              				'new_item_name' 	=>__( 'New Page Category Name' )
    				          ),
    	'query_var' => 'page_categories',
    	'show_ui' => true,
    	'rewrite' => array( 'slug' => 'page_categories', 'with_front' => false ),
    	));

    @mark,

    , is not creating a problem. Above code is running for me. I tested it in my local machine(2010 of WP 3.0);

    Thread Starter marcelobm

    (@marcelobm)

    that’s the thing, on my localhost works perfect, but when i upload the theme to my server, the taxonomy itself appear in the admin, but when you enter the custom menu, doesn’t appear the box with that custom taxonomy

    Ok, but my point being the above code should be inside a function hooked onto init, eg..

    add_action( 'init', 'register_my_tax' );
    function register_my_tax() {
    
        // YOUR CODE HERE
    
    }

    Thread Starter marcelobm

    (@marcelobm)

    yes it is in the functions.php hooked onto the init

    Thread Starter marcelobm

    (@marcelobm)

    I just saw that in the custom menus section, on the top of the page there is a tab called Screen Options, and there is a checkbox for every type of post, category, etc. well so the Page Categories appears there but when I check it to show, nothing happens, and in the localhost that I said this taxonomy appears turns out that if I uncheck the Page Categories, nothing happens.

    Some how on the local host is showing up by default but I can’t control the visibility of the box, and on the server is set to hide by default and I can’t change it to visible.

    any Ideas what can be causing this issue?

    PS. by the way thanks for the replies, Hope anyone can help me to solve this thing.

    I use a taxonomy called page category myself, i don’t have these problems(3.0.1 and 3.1).

    Does it work when you don’t pass any parameters, eg..

    register_taxonomy('Page Category','page');

    Thread Starter marcelobm

    (@marcelobm)

    nop, it doesn’t work either

    Thread Starter marcelobm

    (@marcelobm)

    Hey everyone thank for your replies, I finally found the problem, it was the taxonomy name, apparently when you create a taxonomy that in the name there is a space, it generates the problem I was having, I took out the space and replace it with an underscore and now works prefect.

    and again thank for your help.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘custom Taxonomy doesn't appear in the custom menu’ is closed to new replies.