not found message for wordpress custom taxonomy -
i created custom taxonomy named cancers , template file taxonomy named taxonomy-cancers.php when call url:
http://localhost/cancers
http://localhost/?tax=cancers
wordpress shows page not found , doesn't use taxonomy template. code defining custom taxonomy:
add_action( 'init', 'create_cancers_taxonomy', 0 ); function create_cancers_taxonomy() { // add new taxonomy, make hierarchical (like categories) $labels = array( 'name' => _x( 'سرطانها', 'taxonomy general name' ), 'singular_name' => _x( 'سرطان', 'taxonomy singular name' ), 'search_items' => __( 'جستجو در میان سرطانها' ), 'all_items' => __( 'تمامی سرطانها' ), 'parent_item' => __( 'دسته اصلی' ), 'parent_item_colon' => __( 'دسته اصلی:' ), 'edit_item' => __( 'ویرایش سرطان' ), 'update_item' => __( 'بروزرسانی سرطان' ), 'add_new_item' => __( 'افزودن سرطان' ), 'new_item_name' => __( 'عنوان سرطان' ), 'menu_name' => __( 'سرطانها' ), ); $args = array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, ); register_taxonomy( 'cancers', array('cancer', 'post'), $args ); }
i think forgot add rewrite
parameter in arguments,
use arguments:--
$args = array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'cancers' ), );
note:- after changing this, please update permalinks
settings --> permalinks
once...
Comments
Post a Comment