Want to know what the default PHP string for Wordpress is?

I am trying to add a column to csv which is exported using php file.

At the bottom, below post_dateis the part where I need to know the correct line to get when the Wordpress send / message entry was made. I currently have a request for a default date, but this is only the current time, not the publication time. How can you get the post creation date? I am very grateful for the help!

$surveyArray = array(
      'id'                  => $survey_id,
      'title'               => $survey_title,
      'airline'             => $airlineName,
      'meal'                => $mealName,
      'test_great'          => $get_test_great[0],
      'fair_price'          => $get_fair_price[0],
      'friendly_host'       => $get_friendly_host[0],
      'right_temp'          => $get_right_temp[0],
      'looked_good'         => $get_looked_good[0],
      'would_reorder'       => $get_would_reorder[0],
      'comment'             => $get_comment[0],
      'airlane_race_number' => $get_airlane_race_number[0],
      'post_date'       => $postdate = date ("Y-m-d H:i:s"),
  );
  $allAirlinesAndAnswersInArray[] = $surveyArray;

}

+4
source share
2 answers

Please open WP related topics, Wordpress.Stackexchange.com

ps Solution:

'post_date'       => $postdate = get_the_date( "Y-m-d H:i:s", $survey_id )
+2
source

, wordpress

$blogtime = current_time( 'mysql' );

$surveyArray = array(
      'id'                  => $survey_id,
      'title'               => $survey_title,
      'airline'             => $airlineName,
      'meal'                => $mealName,
      'test_great'          => $get_test_great[0],
      'fair_price'          => $get_fair_price[0],
      'friendly_host'       => $get_friendly_host[0],
      'right_temp'          => $get_right_temp[0],
      'looked_good'         => $get_looked_good[0],
      'would_reorder'       => $get_would_reorder[0],
      'comment'             => $get_comment[0],
      'airlane_race_number' => $get_airlane_race_number[0],
      'post_date'       => $blogtime,
  );
  $allAirlinesAndAnswersInArray[] = $surveyArray;
}
+2

Source: https://habr.com/ru/post/1652280/


All Articles