WordPress.org

Ready to get started?Download WordPress

Forums

Register Custom Taxonomy - Naming Question (1 post)

  1. Leo Blanchette
    Member
    Posted 1 year ago #

    Thanks to Kurt on this post I've re-worked my system to use a custom taxonomy archive to search instead of the method I was using.

    I have a small problem though - maybe I'm overlooking something - I cannot seem to change the taxonomy to say "image search" and instead I seem to be stuck with "image-tags" as I had previously declared.

    Here is what I have:

    register_taxonomy( 'image-tags', array(
             'image'
        ), array(
             'hierarchical' => true,
            'labels' => array(
    			'name' => _x( 'image-search', 'taxonomy general name' ),
    			'singular_name' => _x( 'keyword', 'taxonomy singular name' ),
    			'search_items' =>  __( 'Search Images' ),
    			'all_items' => __( 'All Image Keywords' ),
    			'edit_item' => __( 'Edit Image Keyword' ),
    			'update_item' => __( 'Update Image Keyword' ),
    			'add_new_item' => __( 'Add New Image Keyword' ),
    			'new_item_name' => __( 'New Keyword Name' ),
    			'menu_name' => __( 'Image Keywords' ),
    		),
    		'rewrite' => array(
    			'slug' => 'search-images', // This controls the base slug that will display before each term
    			'with_front' => false, // Don't display the category base before "/locations/"
    			'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/"
    		),
            'singular_label' => 'Image Tag',
            'rewrite' => true,
            'slug' => 'image-tag', 
    
        ) );

    The custom post type it caters to is "image". However image-tags is tacky. I simply wanted to change it to "Image search" in the URL which makes far more sense. When I change it however get_the_term_list( $post->ID, 'image-search', '', ', ', '' ) returns nothing. But with the above taxonomy unchanged (image-tags not changed to image-search) get_the_term_list( $post->ID, 'image-tags', '', ', ', '' ) works fine.

    This really is my last monster problem after a few days of difficulty. I'd love to get it solved!

Topic Closed

This topic has been closed to new replies.

About this Topic