Taxonomy redirects to my 404 page
-
Hello!
I need help regarding taxonomy template. Well I’m not sure of what I’m doing are all right, for I am not a developer. I’m trying though. Hehehe.
I created a custom post type and a custom taxonomy with the help of this website: https://generatewp.com. It really is a big help, and few research on how to query or display my cpt on a template.
Now what I have is a page called “Product Lines” and I think is doing a good job (getting the right URL), but when clicking on a category, it redirects to my 404 page but it has the right URL though.
Screenshots:
Product Lines page – https://rainesatera.com/wp-content/uploads/2014/10/product-lines-page.jpg
404 page – https://rainesatera.com/wp-content/uploads/2014/10/product-lines-taxonomy-page.jpgHere are the templates I created:
archive-prod_lines.php
taxonomy-product-category.phpHere’s my cpt:
function prod_line_post() { $labels = array( 'name' => _x( 'Product Lines', 'Post Type General Name', 'text_domain' ), 'singular_name' => _x( 'Product Line', 'Post Type Singular Name', 'text_domain' ), 'menu_name' => __( 'Product Lines', 'text_domain' ), 'parent_item_colon' => __( 'Parent Item:', 'text_domain' ), 'all_items' => __( 'All Items', 'text_domain' ), 'view_item' => __( 'View Item', 'text_domain' ), 'add_new_item' => __( 'Add New Item', 'text_domain' ), 'add_new' => __( 'Add New', 'text_domain' ), 'edit_item' => __( 'Edit Item', 'text_domain' ), 'update_item' => __( 'Update Item', 'text_domain' ), 'search_items' => __( 'Search Item', 'text_domain' ), 'not_found' => __( 'Not found', 'text_domain' ), 'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ), ); $rewrite = array( 'slug' => 'product-lines', 'with_front' => false, 'pages' => true, 'feeds' => true, ); $args = array( 'label' => __( 'prod_lines', 'text_domain' ), 'description' => __( 'Product Lines items', 'text_domain' ), 'labels' => $labels, 'supports' => array( 'title', 'editor', 'thumbnail', 'revisions', 'post-formats', ), 'taxonomies' => array( 'category', 'post_tag', 'product-category' ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 5, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'rewrite' => $rewrite, 'capability_type' => 'page', ); register_post_type( 'prod_lines', $args ); } // Hook into the 'init' action add_action( 'init', 'prod_line_post', 0 );
Here’s the custom taxonomy:
// Register Custom Taxonomy function prod_line_cat_taxonomy() { $labels = array( 'name' => _x( 'Product Categories', 'Taxonomy General Name', 'text_domain' ), 'singular_name' => _x( 'Product Category', 'Taxonomy Singular Name', 'text_domain' ), 'menu_name' => __( 'Product Category', 'text_domain' ), 'all_items' => __( 'All Items', 'text_domain' ), 'parent_item' => __( 'Parent Item', 'text_domain' ), 'parent_item_colon' => __( 'Parent Item:', 'text_domain' ), 'new_item_name' => __( 'New Item Name', 'text_domain' ), 'add_new_item' => __( 'Add New Item', 'text_domain' ), 'edit_item' => __( 'Edit Item', 'text_domain' ), 'update_item' => __( 'Update Item', 'text_domain' ), 'separate_items_with_commas' => __( 'Separate items with commas', 'text_domain' ), 'search_items' => __( 'Search Items', 'text_domain' ), 'add_or_remove_items' => __( 'Add or remove items', 'text_domain' ), 'choose_from_most_used' => __( 'Choose from the most used items', 'text_domain' ), 'not_found' => __( 'Not Found', 'text_domain' ), ); $rewrite = array( 'slug' => 'product-lines', 'with_front' => true, 'hierarchical' => true, ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => true, 'rewrite' => $rewrite, ); register_taxonomy( 'product-category', array( 'prod_lines' ), $args ); } // Hook into the 'init' action add_action( 'init', 'prod_line_cat_taxonomy', 0 );
Hoping for anyones kind help.
Thank you!
- The topic ‘Taxonomy redirects to my 404 page’ is closed to new replies.