При обновлении из Wordpress Quick Edit я также хочу обновить дату модификации.
Следующий код не обновил его.
Что это за метод?
add_action('save_post', function($post_id, $post) {
global $wpdb;
$now = date('Y-m-d H:i:s', strtotime('+9 hours'));
$gmt = date('Y-m-d H:i:s', strtotime('now'));
$wpdb->update(
$wpdb->posts,
['ID' => $post_id],
['post_modified' => $now],
['post_modified_gmt' => $gmt]
);
}, 10, 2);
Извините, я решил сам.
add_action('save_post', function($post_id, $post) {
global $wpdb;
$now = date('Y-m-d H:i:s', strtotime('+9 hours'));
$gmt = date('Y-m-d H:i:s', strtotime('now'));
$wpdb->update(
$wpdb->posts,
[
'post_modified' => $now,
'post_modified_gmt' => $gmt
],
['ID' => $post_id],
);
}, 10, 2);