WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] permalink not identified correctly (not fully decoded) (13 posts)

  1. agharbeia
    Member
    Posted 7 years ago #

    Greetings,

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

    On this blog: http://zamakan.gharbeia.org 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): http://zamakan.gharbeia.org/2007/06/12/003912
    and
    http://zamakan.gharbeia.org/2007/05/27/004925

    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.

  2. moshu
    Member
    Posted 7 years ago #

    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.

  3. agharbeia
    Member
    Posted 7 years ago #

    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 :)

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    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?

  5. agharbeia
    Member
    Posted 7 years ago #

    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: http://zamakan.gharbeia.org/2007/05/01/035249

    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: http://zamakan.gharbeia.org/2007/04/23/222328 has its GUID set to http://zamakan.gharbeia.org/2007/04/24/000328 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.

  6. agharbeia
    Member
    Posted 7 years ago #

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

    This post: http://zamakan.gharbeia.org/2006/11/15/002309 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?

  7. agharbeia
    Member
    Posted 7 years ago #

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

  8. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

  9. agharbeia
    Member
    Posted 7 years ago #

    Thank you again, Otto. I have reported it http://trac.wordpress.org/ticket/4499

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

  10. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

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

    Try the version found here: http://wordpress.pastebin.ca/579658

    You can download the raw copy from here:
    http://wordpress.pastebin.ca/raw/579658

    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.

  11. agharbeia
    Member
    Posted 7 years ago #

    Yes, it works, Otto.
    Thank you.

  12. afreeorange
    Member
    Posted 7 years ago #

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

  13. Mark Jaquith
    WordPress Lead Dev
    Posted 7 years ago #

    Fixed in changeset [5848]

    This fix will first appear in WordPress 2.3

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic