Custom Taxonomies Not Redirecting Properly
-
My wordpress theme called montreal(https://themeforest.net/item/montreal-interactive-creative-wordpress-theme/3957460) uses a custom post type “portfolio” and custom taxonomy “portfolio-category” and for some reason when i try to view any of the taxonomy items like
https://sickwebmedia.com/portfolio-category/web-design
for example It doesn’t redirect properly. I just get a 404 error. I’m really just trying to have each portfolio category display the query of posts that it is related to when i click the link to it. I would also like to be able to view a list of each portfolio category when I visit the url for the taxonomy (https://sickwebmedia.com/portfolio-category).
I thought that when a custom taxonomy is created, it should be working as described…but I’ve been banging my head around this for a while now and decided its time to get some help.
Below is the code for the custom post type
add_action( 'init', 'register_portfolio' ); function register_portfolio() { $labels = array( 'name' => __( 'Portfolios', 'montreal' ), 'singular_name' => __( 'Portfolio', 'montreal' ), 'add_new' => __( 'Add New', 'montreal' ), 'add_new_item' => __( 'Add New Portfolio', 'montreal' ), 'edit_item' => __( 'Edit Portfolio', 'montreal' ), 'new_item' => __( 'New Portfolio', 'montreal' ), 'view_item' => __( 'View Portfolio', 'montreal' ), 'search_items' => __( 'Search Portfolios', 'montreal' ), 'not_found' => __( 'No portfolios found', 'montreal' ), 'not_found_in_trash' => __( 'No portfolios found in Trash', 'montreal' ), 'parent_item_colon' => __( 'Parent Portfolio:', 'montreal' ), 'menu_name' => __( 'Portfolios', 'montreal' ), ); //AND HERE'S AN ARRAY OF ARGUMENTS TO DEFINE PORTFOLIOS FUNCTIONALITY $args = array( 'labels' => $labels, 'hierarchical' => false, 'description' => __('Portfolio entries for the montreal Theme.', 'montreal'), 'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'post-formats' ), 'taxonomies' => array( 'portfolio-category' ), 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 5, 'show_in_nav_menus' => true, 'publicly_queryable' => true, 'exclude_from_search' => true, 'has_archive' => true, 'query_var' => true, 'can_export' => true, 'rewrite' => true, 'capability_type' => 'post' ); register_post_type( 'portfolio', $args ); flush_rewrite_rules(); }' and the custom taxonomy 'add_action('init', 'create_portfolio_taxonomies'); function create_portfolio_taxonomies(){ register_taxonomy('portfolio-category', 'portfolio', array('hierarchial' => true, 'label' => 'Portfolio Categories', 'singular_label' => 'Portfolio Category', 'rewrite' => true)); }
- The topic ‘Custom Taxonomies Not Redirecting Properly’ is closed to new replies.