mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-23 19:33:44 +03:00
My Pledges: Only trigger status changes when needed.
This commit is contained in:
parent
1023fdeb55
commit
7cbe722202
|
@ -347,13 +347,13 @@ function process_my_pledges_form() {
|
||||||
$message = "You have left the {$pledge->post_title} pledge.";
|
$message = "You have left the {$pledge->post_title} pledge.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'publish' === $status ) {
|
if ( 'publish' === $status && 'publish' !== $contributor_post->post_status ) {
|
||||||
wp_update_post( array(
|
wp_update_post( array(
|
||||||
'ID' => $contributor_post_id,
|
'ID' => $contributor_post->ID,
|
||||||
'post_status' => $status,
|
'post_status' => $status,
|
||||||
) );
|
) );
|
||||||
} elseif ( 'trash' === $status ) {
|
} elseif ( 'trash' === $status && 'trash' !== $contributor_post->post_status ) {
|
||||||
remove_contributor( $contributor_post_id );
|
remove_contributor( $contributor_post->ID );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $message;
|
return $message;
|
||||||
|
|
Loading…
Reference in a new issue