1

I have an issue pertaining specifically to the situation in which permalinks are set to be based only on publication date. My permalink structure is as follows:

/%year%%monthnum%%day%/

When I try to preview a post, I get 404. The issue does not come up when I add other URL tags to the structure, like post ID or post name.

I have already tried to diagnose the issue and one thing that came up was that Wordpress may be treating URLs consisting only of date tags as date archive pages. Indeed, is_date() returns TRUE when a post page is displayed.

Is there a way around it that does not involve changing permalink structure? Thanks for help.

8
  • 1
    That permalink structure works just fine for me with the preview feature, i suggest you diagnose the problem further. I copied the structure you posted above as is, and previewed a post, it did not produce a 404.
    – t31os
    May 6, 2013 at 10:28
  • Thank you, I will try to dig deeper. Do you have a separate template file for single posts (single.php) in your theme?
    – user4315
    May 6, 2013 at 10:42
  • 1
    I'm using a child theme for the TwentyThirteen theme, but yes, it does have a single.php template.
    – t31os
    May 6, 2013 at 10:51
  • OK, I have isolated a condition for this issue. It comes up only when previewing posts that are scheduled for future publication and are not drafts anymore. Drafts or posts already published do not cause this issue. Also, I have switched my theme to TwentyTwelve and it clearly shows that when I navigate to a post page (for example domain.com/20120201), it treats it as a date (daily) archive page. Could you check if it is the case with your WP installation? Thanks!
    – user4315
    May 6, 2013 at 12:07
  • 1
    there's no way to uniquely identify a single post with that structure. what if 2 posts are published on the same date?
    – Milo
    May 6, 2013 at 15:02

1 Answer 1

0

I will sum up my findings for future use by others:

  1. When using permalink structure that uses only date tags, Wordpress is unable to identify a unique post because there may be more posts in any given day.
  2. For this reason Wordpress treats URLs with date based tags only as date archive pages.
  3. Given the permalink structure, Wordpress still allows for previewing of posts with present or past publication date (published or drafts) and posts that have publication date set for the future and are still drafts. Previewing posts that are scheduled for future publication and are not drafts, is impossible - they will return the 404 error.

@Milo, @t3los, thanks for your input.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.