SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jan 2014
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Custom Taxonomy Not Redirecting Properly

    My wordpress theme 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

    http://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 (http://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

    PHP Code:
    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' ),
        );

        
    $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

    PHP Code:
    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));


  2. #2
    SitePoint Addict
    Join Date
    Oct 2008
    Location
    Virtual World is my location
    Posts
    311
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Have you tried resaving the Permalinks once you created the custom taxonomies? Sometimes you need to flush the permalinks and regenerate them by going to Permalinks and saving the structure and then it usually works fine. Also you can try by temporarily disabling permalinks and checking if the redirect works fine. Usually regenerating the permalinks solves the issues.
    RecipesNext.com - recipes, kitchen queries, videos & more...
    BargainNext.com - coupons / deals / bargains / offers & more...

  3. #3
    SitePoint Member
    Join Date
    Jan 2014
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jaagare View Post
    Have you tried resaving the Permalinks once you created the custom taxonomies? Sometimes you need to flush the permalinks and regenerate them by going to Permalinks and saving the structure and then it usually works fine. Also you can try by temporarily disabling permalinks and checking if the redirect works fine. Usually regenerating the permalinks solves the issues.
    Yup....tried that.. nothing. Thanks for the suggestion though..

    Anyone else care to share some ideas?

  4. #4
    SitePoint Addict
    Join Date
    Oct 2008
    Location
    Virtual World is my location
    Posts
    311
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    For the custom taxonomy try adding this

    Code:
    'query_var' => true
    just before rewrite true. then resave permalinks and try again

    also try if the category works without the permalinks because if that doesnot work then there might be other issues
    RecipesNext.com - recipes, kitchen queries, videos & more...
    BargainNext.com - coupons / deals / bargains / offers & more...


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •