Support » Installing WordPress » permalink not identified correctly (not fully decoded)

  • Resolved agharbeia



    This is a little bit complex, so please bear with me.

    On this blog: I’m having an issue where permalinks for certain posts are not identified as such.

    Meaning that when the permalink URL is visited, the post is displayed in the context of an Archive page for the month, instead of that of a single post.

    This is also reflected in such a way that within the code is_single() resolves to ‘false’ and all conditional code depending on it fails, including the comments_template() call.

    I have only index.php, and no single.php, although trying to create the recent file (for testing) hasn’t resulted in any change in behaviour.

    I also tried disabling all plug-ins to no avail.

    This strange behaviour happens only with the most two recent posts (as far as I know):

    I’m not sure whether this started only since I upgraded to 2.2, or that it was there before the upgrade.

    The latest post was posted after I upgraded. The one before it was there before, but I became aware of it having this behaviour since I upgraded.

    Both posts have their GUID field in the DB set to be identical to their respective permalink generated by WP, and also to their respective post_date field. I thought this might be relevant because of my permalink structure explained below.

    I have a somewhat long – but in my opinion very systematic and efficient – permalink structure: /%year%/%monthnum%/%day%/%hour%%minute%%second%

    I use it because it’s fixed-length, and sub-parts of it display meaningful archives for year, month, day.

    In fact this issue I’m having can be described by saying that with these two posts mentioned above, the permalink is parsed/decoded only up to the day portion of it, and the last part which identifies a unique post is ignored. This can be seen from the title in the browser’s title bar which displays an archive for the day when it should display a single post.

    I have a very long and hand crafted .htacces, which I haven’t changed in a long time.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Not having anything else in the permalinks structure just “time”-related components… I am afraid WP senses it as an “archive”. Just out of curiousity, try to put something like post ID in the permalinks.

    But, moshu, this has been working perfectly for the past two years!

    Besides, the idea is to try to solve this issue while keeping this permalink structure.

    Actually, if I were to change it I would avoid the ID specifically because I don’t want anything that is implementation-specific. I’m writing a plug-in that will make comment IDs not dependent on their DB entries and thus enabling true permalinks for comments.

    I’m afraid I’m a digital preservation freak 🙂

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Without the %post_id% or %postname% as part of the permalink structure, it cannot narrow it down to a single post, even with the hour minute and second fields being there. Since it cannot determine which post is being referred to, it falls through to the archive sections.

    This is a limitation of WordPress that probably should be more clearly stated, but permalinks must include either %post_id% or %postname% for the single post links to work.

    Edit: Never mind that, you were correct. I didn’t know until I looked at the code, but with all components of the date, including hour+minute+second, you should get a single post back. Hmmm… Let me look closer.

    Question: Does it still work correctly if the hour is not zero?

    Otto, thank you for taking time to look into this.

    Regarding your question about the time having hours other than zero, I guess that the answer should be yes, since I have all sorts of time combinations in my archive, and let me clarify that I have been using this permalink structure since I started using WP. Not that I am just trying it now.

    This is a good note, however, since both subject posts have their hour as zero, something I haven’t paid attention to when I was debugging.

    The third to last post, which doesn’t have hours set to zero works perfectly:

    What I need to find now is a an earlier post that has a zero-hour and which still resolves normally. (They all worked before because I have always had at least a comment on each post for the past two years)

    As a side issue:

    Now that I’m trying to verify the relation of the zero-hour to the issue, I’m becoming distracted by questions about the kind of relation between GUID and the permalink and the post’s time of creation as recorded in post_date.

    To explain the cause of my confusion:
    This post: has its GUID set to which is probably its true time of publication before I manually changed its timestamp through the editor interface to keep it on the day I want it on, which is the day I started working on it (two hours before midnight). I do this sometimes and it never caused problems.

    Despite of the discrepancy between the GUID in the DB and the permalink, the post is resolving normally.

    Otto, your sharp note is the answer. It is the zero hour!

    This post: which resolved perfectly well before I had upgraded to WP 2.2, now does not 🙁

    I’m sure it worked before because:
    1. I always visit all my posts more than once using the normal navigation interface available to readers, just to check things.

    2. It has comments. Something that is now impossible because there’s no way to reach the post-specific page.

    Do you think it is a bug in 2.2? Something missed in the refactoring?

    I’d like to report this as a bug in 2.2.
    Where should I do this?

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Thank you again, Otto. I have reported it

    For now I guess I will have to avoid publishing at the zero hour.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    I modified a copy of 2.2’s query.php to fix this issue, I think.

    Try the version found here:

    You can download the raw copy from here:

    See if that fixes the problem. Just replace wp-includes/query.php with that file. Keep a backup of the original query.php file, of course.

    Yes, it works, Otto.
    Thank you.

    I was looking for a fix for this 5 minutes ago! Thank you so much for your work 🙂

    Fixed in changeset [5848]

    This fix will first appear in WordPress 2.3


Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘permalink not identified correctly (not fully decoded)’ is closed to new replies.