I want to update my wordpress posts based on exact time including hours, minutes and seconds, I tried the simple where clause, it seems ignoring the minutes and seconds, here is my simple query:
$date = '2023-05-16 07:28:31'; $res = $wpdb->get_results("SELECT ID FROM wp_posts where post_date = '".$date."'");
The result in this case return all the records with 2023-05-16
but I want only the posts with the exact time.
WP_Query
and the date parameters? If you're going to do raw SQL you should use$wpdb->prepare
to insert the variables rather than doing it directly so that it's safer