내가 게시 된 날짜를 메타 박스 필드 날짜에서 업데이트 할 때 작동하지 않습니다. save_post 후크를 사용하고 있지만 제대로 작동하지 않습니다. 게시 날짜를 업데이트하는 데 사용되는 함수는 다음과 같습니다. Wordpress 업데이트 게시 날짜
내 코드 :// Update publisged date from date of launch for concept
function update_concept_post_date($post_id){
if (! wp_is_post_revision($post_id)){
$post_data = get_post($post_id);
$date = get_post_meta($post_id, '_cmb_concept_signup_date', true);
$updated_date = explode('-', $date);
$new_date = date("Y-m-d h:i:s", mktime(0,0,0,$updated_date[1],$updated_date[2],$updated_date[0]));
if($post_data->post_type == 'concepts'){
$my_post = array(
'ID' => $post_id,
'post_date' => $new_date
);
// update the post, which calls save_post again
wp_update_post($my_post);
}
}
}
add_action('save_post', 'update_concept_post_date', 10);
이것은 사용자 정의 메타입니다.이 값의 형식은 무엇입니까? –
게시일의 날짜는 (Y-m-d h : i : s)입니다. –
날짜 분석 섹션이 잘못되었습니다. 내 대답을 참조하십시오 –