Set post date before 1970

I have a custom post type called books. The books publication date is from between 1700 and 1900.

I want to set the post date to these dates(so i can query the results sorted by year) but i can’t seem to have a date set before 1970 january 1.

Read More

Is it possible to somehow do that?

Related posts

Leave a Reply

2 comments

  1. Do not use the post_date field for anything it isn’t made for. Use a post meta field instead. The post_date is bound to post_date_gmt, you would get strange side effect even you could get an earlier date into that.

    So create post meta fields and query those per tax query. Ignore the default field.

    In answer to your comment: Do not use a taxonomy.

    1. Taxonomies are build to allow multiple terms per post (ignore post-formats here). The scheme does not match your use case.
    2. Taxonomy queries are expensive, they run through three tables.
    3. You would have to change the default interface to prevent accidents like multiple assignments. Possible, but not exactly simple and maybe not forward-compatible.

    I started a book manager plugin once too, unfortunately it is still in a draft status … but I have some recommendations regarding dates:

    1. Use two post types: one for the opus, one for the real editions (the opus type would be a parent for multiple editions). So you can store the creation date in the opus, the publication date (the language, the editor, translator and so on) in the edition.

    2. Read Making <time> safe for historians. Dates before 1970 are hard.

    3. The MySQL Date and Time Functions cannot handle all cases, you end up with some custom routines for sorting, depending on your solution for (2.).