WPCF7_REST_Controller::delete_contact_form()
Метод класса: WPCF7_REST_Controller{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$WPCF7_REST_Controller = new WPCF7_REST_Controller(); $WPCF7_REST_Controller->delete_contact_form( $request );
- $request(WP_REST_Request) (обязательный)
- -
Код WPCF7_REST_Controller::delete_contact_form() WPCF7 REST Controller::delete contact form CF7 5.9.8
public function delete_contact_form( WP_REST_Request $request ) { $id = (int) $request->get_param( 'id' ); $item = wpcf7_contact_form( $id ); if ( ! $item ) { return new WP_Error( 'wpcf7_not_found', __( "The requested contact form was not found.", 'contact-form-7' ), array( 'status' => 404 ) ); } $result = $item->delete(); if ( ! $result ) { return new WP_Error( 'wpcf7_cannot_delete', __( "There was an error deleting the contact form.", 'contact-form-7' ), array( 'status' => 500 ) ); } $response = array( 'deleted' => true ); return rest_ensure_response( $response ); }