wp_update_post gives 500 internal error

Question

i’m editing a wordpress plugin and im trying to call a function within the thank you page, and in that function it has wp_update_post function to change the status in the database, the function works fine and i can see that the status was changed in the database yet the php page where the fucntion is called doesn’t load and gives 500 internal server error.
the code is

public function update_status( $status = 'donate-processing' ) {

    if ( !$this->id )
        return;

    if ( strpos( $status, 'donate-' ) !== 0 ) {
        $status = 'donate-' . $status;
    }

    wp_update_post( array( 'ID' => $this->id, 'post_status' => $status ) );
    $old_status = get_post_status( $this->id );
    $old_status = substr( $old_status, strlen( 'donate-' ) );
    $status = substr( $status, strlen( 'donate-' ) );
    $this->send_email( $status );
}
0
, , , omarhabeh 2 years 2020-07-05T14:10:28-05:00 0 Answers 78 views 0

Leave an answer

Browse
Browse