mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-18 17:33:43 +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.";
|
||||
}
|
||||
|
||||
if ( 'publish' === $status ) {
|
||||
if ( 'publish' === $status && 'publish' !== $contributor_post->post_status ) {
|
||||
wp_update_post( array(
|
||||
'ID' => $contributor_post_id,
|
||||
'ID' => $contributor_post->ID,
|
||||
'post_status' => $status,
|
||||
) );
|
||||
} elseif ( 'trash' === $status ) {
|
||||
remove_contributor( $contributor_post_id );
|
||||
} elseif ( 'trash' === $status && 'trash' !== $contributor_post->post_status ) {
|
||||
remove_contributor( $contributor_post->ID );
|
||||
}
|
||||
|
||||
return $message;
|
||||
|
|
Loading…
Reference in a new issue