Post status transition with quick edit / bulk action
-
Hello,
I want to change the publish date when a post / post type is changed to a custom post status
release
.This is my code:
function status_transition_test($new_status, $old_status, $post) { $time = current_time('mysql'); if($old_status != 'release' && $new_status == 'release') { $data = array( 'post_status' => 'release', 'post_date' => $time, 'post_date_gmt' => get_gmt_from_date($time), ); wp_update_post($data); } } add_action('transition_post_status', 'status_transition_test', 10, 3);
This works fine when I open a post, change the status and save it.
But if I change the status via quick edit / bulk action the date doesn’t change. I also tried to use the hookdraft_to_release
for example but this doesn’t work either.Does somebody have an advice, maybe I need to use another hook?
Best regards
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Post status transition with quick edit / bulk action’ is closed to new replies.