• i created a custom taxonomy named cancers and a template file for this taxonomy named taxonomy-cancers.php but when i call this url:

    http://localhost/cancers even http://localhost/?tax=cancers

    wordpress shows page not found and doesn’t use my taxonomy template. this is my code for defining custom taxonomy:

    add_action( 'init', 'create_cancers_taxonomy', 0 );
    function create_cancers_taxonomy() {
    // Add new taxonomy, make it 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 );
    }
  • The topic ‘not found message for wordpress custom taxonomy’ is closed to new replies.