Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Post_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,6 @@ public function generate( $args, $assoc_args ) {

// Add time if the string is a valid date without time.
$date = DateTime::createFromFormat( 'Y-m-d', $post_data['post_date'] );
$date = DateTime::createFromFormat( 'Y-m-d', $post_data['post_date'] );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While removing this duplicate line is correct, the overall logic for appending a default time to post_date is duplicated for post_date_gmt a few lines below (lines 786-789). To improve maintainability and adhere to the DRY (Don't Repeat Yourself) principle, consider extracting this logic into a private helper method.

if ( $date && $date->format( 'Y-m-d' ) === $post_data['post_date'] ) {
$post_data['post_date'] .= ' 00:00:00';
}
Expand Down
Loading