Support » Plugins and Hacks » [Resolved] [Plugin: WP-No-Tag-Base] possible malfunction?

[Resolved] [Plugin: WP-No-Tag-Base] possible malfunction?

  • Since updating the plugin I am having weird ‘too many redirects’ errors on any posts I’m entering. The frontpage works fine. I don’t see anything in the errors logs, and the access logs show a loop of 301 redirects to the same URLs. After resubmitting ‘Permalink Settings’, the page works again for a short time only.

    Could this be related with the latest update?


Viewing 15 replies - 1 through 15 (of 18 total)
  • I traced it down to at least the no_tag_base_request function. When I commented out status_header(301); I suddenly got 302 redirects and vice versa.

    function no_tag_base_request($query_vars) {
            //var_dump($query_vars); // For Debugging
        //backwards compatibility for older WP versions
            if(isset($query_vars['tag_redirect'])) {
            $tag =  user_trailingslashit($query_vars['tag_redirect'], 'post_tag');
            $taglink = trailingslashit(get_option( 'home' )) . $tag;
                    header("Location: $taglink");
            return $query_vars;

    Hm, I can’t pinpoint it yet to this plugin or any other. It simply appeared just recently and it appears so far very sporadically.

    $wp_rewrite->flush_rules(); seems to solve it temporarily, until it starts again. Basically no canonical URLs seem to work until the rules have been flushed; and every link just shows the front page. ?p=XXX links try to forward to the canonical URLs, which then again show the frontpage.

    I wonder what is destroying them.
    The 301 behaviour could be a side-effect due to tag_redirect being set.

    Interesting part is that although I have disabled the plugin, the tags are still working without the base. Although the tag base is set to ‘tag’ and the links also show /tag/X. They end up on a 404 page, and if you manually remove /tag/ from the URL, the tag page is being displayed.

    It could be related with an ( even deactivated ) simple tags plugin. I have now deleted it, and am looking for the bug to reappear again.

    It’s very interesting how persistent tag plugins are, even if they are deactivated.

    I have used this file to debug the issue. https://gist.github.com/2321074

    permalink structure
    page permastruct
    matched rule and query
    matched query

    From the printout of the rules it seems that ‘(.+)$’ => ‘index.php?tag_redirect=$matches[1]’ comes before the category rewrites. It’s induced in the middle of the rewriterules, so it matches before anything else can match.

    so possibly instead of replacing a match all rule $old_base = str_replace( '%post_tag%', '(.+)', $old_base ); the (.+) rule should be added to the bottom of the rewrite rules?

    I removed the old tag base redirect support for now.

    //global $wp_rewrite;
    //$old_base = $wp_rewrite->get_tag_permastruct();
    //$old_base = str_replace( '%post_tag%', '(.+)', $old_base );
    //$old_base = trim($old_base, '/');
    //$tag_rewrite[$old_base.'$'] = 'index.php?tag_redirect=$matches[1]';

    Let’s see if it keeps working. Can you confirm for when this would be necessary?

    Plugin Author Devin Walker


    Hi Disagree – Are you by chance using the “No Category Parent” plugin alongside WP-No-Tag-Base?


    This plugin doesn’t play nicely with the newer version of WP-No-Tag-Base. I recommend WP No Category Base plugin coupled with this one. Let me know if that’s what you’re using or not.

    No, not using it.

    After removing the $old_base part I have so far not had any malfunctions.

    About my previous comment that the rule was coming before any category rewrites – that was the wrong formulation.

    The tag base / (.+) rewrite came before any 2012/0*/* rewrites. So whenever I would enter a post, it would instead trigger the (.+) rewrite.

    That is due to the original tag_base rewrite being in the middle of the rewrite rules. I suppose if it would be in the bottom, instead of the middle, this issue wouldn’t come up, as it would only get triggered if no other rewrite rule would match.

    Plugin Author Devin Walker


    Hmm so commenting out the old tag base redirect support fixed it for you? What version of WP are you running? I’m going to mark this as resolved.

    I have the same problem.

    When I change a tag (create a new or delete old one), I begin to have problems with redirects.

    Possible related with that I have the following plugins installed:

    WP No Category Base – WPML compatible
    Dean’s Permalinks Migration

    I was having some odd problems where the permalinks wouldnt work on some articles and even some plugins. I am using the latest version 1.2.2. I would have to go save the permalink settings and they would work again. I am using the WP No Category Base – WPML compatible plugin and I have tried the WP No Category Base plugin from the other author with the same issues. I commented out lines 74 – 78 for old tag base support. So far no more errors. I am also watching this to see if this fixes the issue. So far it seems to resolved the issue with no side effects. Could you explain a bit what these lines are for?

    Same problem, same plugin, this one, it sucks.

    When I de- and activate the plugin, the loop is gone, but then suddenly, the problem appears again and again and again.

    What does “resolved” stand for – I still got that problem, nothing “resolved” here.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Resolved] [Plugin: WP-No-Tag-Base] possible malfunction?’ is closed to new replies.