Support » Themes and Templates » Custom Post Type and Taxonomy Permalinks

  • I’ve been working with custom post types to separate the portfolio section of my website from my blog. I ran into a problem with the rewrite variables and permalinks.
    I set up a custom post type of ‘portfolio’ with a rewrite slug of ‘portfolio’
    I set up a custom taxonomy of ‘portfolio-category’ with a rewrite slug of ‘portfolio’ – shows all the portfolio post types using /portfolio.php – shows the individual post using /single-portfolio.php – shows all the “landscapes” for example using /taxonomy-portfolio-category.php

    I got the first two parts to work OK, but the taxonomy is throwing 404 at me.
    If I change the post_type rewrite to something else (‘photo’) then the taxonomy works, fine, but I would like them to share permalinks like the default posts can.

    Any help would be great, or if you know how this will play out with the final 3.0 release please share.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Next problem I found in the same topic is that both the (/portfolio.php) and (/taxonomy-portfolio-category.php) are showing up as is_single().
    It would make more sense to be it to be is_category() or is_taxonomy() or something else.

    I have the same issues or at least similar issues. Made a custom type portfolio with posts with custom fields. Added a test post and the permalink for that post did not work. First it showed the raw user unfriendly url and the it threw me a 404 now as well. I know custom types take single.php as a standard template, but I read somewhere that can be adjusted. If I find that intel again I will post back.
    On top of that I cannot use the permalink button on the portfolio page. It just sends me to the permalink config page while I already have the permalinks running. Maybe I need a custom permalink setup now that I use custom types?

    Well I added rewrite = true to my registered post type and now permalinks work, but still give me a 404:

    register_post_type('portfolio', array(
    	'label' => __('Portfolio'),
    	'singular_label' => __('Portfolio'),
    	'rewrite' => true,
    	'public' => true,
    	'show_ui' => true,
    	'capability_type' => 'post',
    	'hierarchical' => false,
    	'query_var' => false,
    	'supports' => array('title', 'editor', 'author' )

    I will check for some options custom post types apparently do not have..

    You need to refresh you permalinks…

    Simply go to your “Permalinks” page under “Settings” in your admin area – Click save just to be on the safe side, and it will rebuild your permalinks

    Then job done – refresh the page you were having 404 problems with

    Defade, I have read this a lot but it’s not working for me. Saving Permalinks is not refreshing/rebuilding my permalinks. Is there any situation people know of where this happens? This is on my localhost using Wamp server…

    Oops… I guess typing out “localhost” and “wamp” triggered my memory. Permalinks wasn’t working because I hadn’t enabled the rewrite module on wamp. For those needing to do that: Check this post

    also your problem here could be that you have ‘query_var’ => false

    @everybody: I got the same problem here…Did anybody find a proper solution(not flushing the rules..)??

    Same for me, i’ve been trying tons of options, no chance so far. My only problem comes from the pagination, all works fine,,, but the doesnt.

    In my case it’s the same as Kevin described. Please help us!

    Found the solution for me; i had a custom post type named ‘fotolog’ and also a page named ‘fotolog’ to load those posts.

    More infos here and here.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Custom Post Type and Taxonomy Permalinks’ is closed to new replies.