| @@ -125,16 +125,12 @@ | ||
| 125 | 125 | * |
| 126 | 126 | * @return WP_Error|boolean |
| 127 | 127 | */ |
| 128 | 128 | public function _permission_check( WP_REST_Request $request ) { |
| 129 | - $this->request = $request; | |
| 130 | - $this->api_key = $this->utils('options')->get( 'api_key' ); | |
| 131 | 129 | if(!current_user_can('delete_posts')){ |
| 132 | 130 | return false; |
| 133 | 131 | } |
| 134 | 132 | |
| 135 | - add_filter('wp_redirect', '__return_false', 999); | |
| 136 | - | |
| 137 | 133 | return $this->permission_check( $request ); |
| 138 | 134 | } |
| 139 | 135 | |
| 140 | 136 | /** |
| @@ -229,24 +225,8 @@ | ||
| 229 | 225 | * @return WP_REST_Response |
| 230 | 226 | */ |
| 231 | 227 | public function success( $data ) { |
| 232 | 228 | return new WP_REST_Response( $data, 200 ); |
| 233 | - } | |
| 234 | - | |
| 235 | - /** | |
| 236 | - * Enhanced success response wrapper that automatically adds success flag and wraps data | |
| 237 | - * | |
| 238 | - * @param $data mixed The data to be wrapped in the response | |
| 239 | - * | |
| 240 | - * @return WP_REST_Response | |
| 241 | - */ | |
| 242 | - public function successWithData( $data ) { | |
| 243 | - $enhanced_response = [ | |
| 244 | - 'success' => true, | |
| 245 | - 'data' => $data | |
| 246 | - ]; | |
| 247 | - | |
| 248 | - return $this->success( $enhanced_response ); | |
| 249 | 229 | } |
| 250 | 230 | /** |
| 251 | 231 | * @param $error_code string |
| 252 | 232 | * @param $error_message string|array |