WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Permalink rewriting in 3.0 (36 posts)

  1. playitusa
    Member
    Posted 3 years ago #

    /%category%/%year%/%monthnum%/%post_id%/%postname%/

    But, whatever structure you could use, it doesn't matter, simply doesn't work.

    But, before last wp update, it worked!

    What happened in last update?

  2. Hugh Mandeville
    Member
    Posted 3 years ago #

    See the category archive plugin FAQ.

    To get the plugin to work with permalinks in WP3.1, you need to update the redirect_canonical() function in canonical.php. On line 167, wrap the following code:

    $tax_url = parse_url($tax_url);
    if ( ! empty($tax_url['query']) ) { // Custom taxonomies may only be accessable via ?taxonomy=..&term=..
        parse_str($tax_url['query'], $query_vars);
        $redirect['query'] = add_query_arg($query_vars, $redirect['query']);
    } else { // Taxonomy is accessable via a "pretty-URL"
        $redirect['path'] = $tax_url['path'];
    }

    in an if (is_tax()) block:

    if (is_tax()) {
        $tax_url = parse_url($tax_url);
        if ( ! empty($tax_url['query']) ) { // Custom taxonomies may only be accessable via ?taxonomy=..&term=..
            parse_str($tax_url['query'], $query_vars);
            $redirect['query'] = add_query_arg($query_vars, $redirect['query']);
        } else { // Taxonomy is accessable via a "pretty-URL"
            $redirect['path'] = $tax_url['path'];
        }
    }
  3. petra5
    Member
    Posted 3 years ago #

    Thanks Hugh for your reply. I am using wp 3.1 so I changed the code as per above. in my .htaccess I have:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    My permalinks settings are:
    /%category%/%year%/%monthnum%/%post_id%/%postname%/

    Now when I click on a specific month I still don't get the results I should, instead I kind of stay on the same page.
    Any other suggestions?

  4. Hugh Mandeville
    Member
    Posted 3 years ago #

    Not sure, maybe clear your cache. I tried the same permalink structure you have

    /%category%/%year%/%monthnum%/%post_id%/%postname%/

    and it works for me. The month links should look something like

    /category-label/2011/03/

  5. playitusa
    Member
    Posted 3 years ago #

    Thank you Hugh, now it works !!!

  6. petra5
    Member
    Posted 3 years ago #

    I don't know why it doesn't work for me. :(
    I wonder if it's because I have category base set up as Categories in Permalinks settings?
    i changed:

    $tax_url = parse_url($tax_url);
    if ( ! empty($tax_url['query']) ) { // Custom taxonomies may only be accessable via ?taxonomy=..&term=..
        parse_str($tax_url['query'], $query_vars);
        $redirect['query'] = add_query_arg($query_vars, $redirect['query']);
    } else { // Taxonomy is accessable via a "pretty-URL"
        $redirect['path'] = $tax_url['path'];
    }

    TO

    if (is_tax()) {
        $tax_url = parse_url($tax_url);
        if ( ! empty($tax_url['query']) ) { // Custom taxonomies may only be accessable via ?taxonomy=..&term=..
            parse_str($tax_url['query'], $query_vars);
            $redirect['query'] = add_query_arg($query_vars, $redirect['query']);
        } else { // Taxonomy is accessable via a "pretty-URL"
            $redirect['path'] = $tax_url['path'];
        }
    }

    BUT the problem is still there. does anybody have any other suggestions please?

Topic Closed

This topic has been closed to new replies.

About this Topic