Results 1 to 4 of 4

Thread: Rewrites, Permalink

  1. #1
    kucrut is offline Hello World
    Join Date
    Apr 2010
    Posts
    11

    Default Rewrites, Permalink

    Hi all,

    I've been struggling with permalink for a few days, so I thought I'd start a thread here to get some ideas/help from you guys :)

    Let's say I registered two custom post types named 'gallery' and 'location'. I've enabled the rewrite and query_var for both. The problem is, when I created a post for each type with the same slug, WP always redirect to the first created post. So,


    1. post ID :5, URL: http://site.tld/gallery/postname/
    2. post ID :6, URL: http://site.tld/location/postname/

    I couldn't get to post 6 because WP always redirect to post 5.

    I'm also having problem with creating year/month-based archives for custom post types. So I think the best solution is to remove all WP-generated rewrite rules and create a new set from scratch. I don't know how to do this yet though, because flushing them will make no difference since WP will create them again :)

    Any idea?

    Thanks.

  2. #2
    kucrut is offline Hello World
    Join Date
    Apr 2010
    Posts
    11

    Default

    Hmm, seems like rebuilding the rewrite rules twice fixes the first issue. One problem left is creating year/month-based archive for custom post types with clean URL.

    Any idea/help will be greatly appreciated :)

  3. #3
    kucrut is offline Hello World
    Join Date
    Apr 2010
    Posts
    11

    Default

    This is getting more and more insteresting. Turns out the permalink issue doesnt have anything to do with custom post, the culprit is taxonomy!

    With default URL setting, I can get to http://site.tld/?taxonomy=term&year=2010 just fine. However, I can't seem to make it work with pretty URL. http://site.tld/taxonomy/term/2010 or http://site.tld/2010/taxonomy/term will always redirect to http://site.tld/taxonomy/term, even after adding some rewrite rules and query vars :(

  4. #4
    Ipstenu's Avatar
    Ipstenu is offline Big Tipper
    Join Date
    Feb 2010
    Posts
    368

    Default

    How did you set up your taxonomies? There's a bit in the code for rewrite. Did you make sure that's true?

    Code:
    register_taxonomy( 'myterm', 'post', array( 'hierarchical' => false, 
    'label' => 'My Term', 'query_var' => true, 'rewrite' => true ) );

Posting Permissions

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