Improve guard clause for date update block

This commit is contained in:
Tetrakern 2024-12-22 07:56:28 +01:00
parent c35cbd46ed
commit fde4762e94

View File

@ -1561,7 +1561,7 @@ if ( ! current_user_can( 'manage_options' ) ) {
function fictioneer_prevent_publish_date_update( $data, $postarr ) {
// New post?
if ( $postarr['post_status'] === 'auto-draft' || empty( $postarr['post_date_gmt'] ) ) {
if ( empty( $postarr['ID'] ) || $postarr['post_status'] === 'auto-draft' || empty( $postarr['post_date_gmt'] ) ) {
return $data;
}