Forums » Developing with WordPress » Post title and date conflict in wp_insert_post()

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m not quite sure why the title would be affected, but the get_post_time function using ‘U’ gives the time in a Unix time stamp, but the post_date field is a date/time that looks like ‘0000-00-00 00:00:00’. I think you would be better off just using get_post() at the top, and use the value that is in post_date and post_date_gmt, as it says at the top of

    You can set the post date manually, by setting the values for ‘post_date’ and ‘post_date_gmt’ keys.

    I didn’t like seeing your use of a variable called $post, but you didn’t say
    global $post; so it should be okay (just bad form to use the same name as a global).

    Thread Starter ventatto


    I didn’t even think to use get_post() ! Now it’s working and code is way simpler. I also changed my variable name :).

    Thanks for the tip !

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Post title and date conflict in wp_insert_post()’ is closed to new replies.