@@ 178-186 (lines=9) @@ | ||
175 | $post->post_type = $this->post_type; |
|
176 | $post_id = wp_insert_post( $post, true ); |
|
177 | ||
178 | if ( is_wp_error( $post_id ) ) { |
|
179 | ||
180 | if ( in_array( $post_id->get_error_code(), array( 'db_insert_error' ) ) ) { |
|
181 | $post_id->add_data( array( 'status' => 500 ) ); |
|
182 | } else { |
|
183 | $post_id->add_data( array( 'status' => 400 ) ); |
|
184 | } |
|
185 | return $post_id; |
|
186 | } |
|
187 | $post->ID = $post_id; |
|
188 | $post = get_post( $post_id ); |
|
189 | ||
@@ 259-266 (lines=8) @@ | ||
256 | } |
|
257 | // Convert the post object to an array, otherwise wp_update_post will expect non-escaped input. |
|
258 | $post_id = wp_update_post( (array) $post, true ); |
|
259 | if ( is_wp_error( $post_id ) ) { |
|
260 | if ( in_array( $post_id->get_error_code(), array( 'db_update_error' ) ) ) { |
|
261 | $post_id->add_data( array( 'status' => 500 ) ); |
|
262 | } else { |
|
263 | $post_id->add_data( array( 'status' => 400 ) ); |
|
264 | } |
|
265 | return $post_id; |
|
266 | } |
|
267 | ||
268 | $post = get_post( $post_id ); |
|
269 | $this->update_additional_fields_for_object( $post, $request ); |
@@ 149-157 (lines=9) @@ | ||
146 | $post->post_type = $this->post_type; |
|
147 | $post_id = wp_insert_post( $post, true ); |
|
148 | ||
149 | if ( is_wp_error( $post_id ) ) { |
|
150 | ||
151 | if ( in_array( $post_id->get_error_code(), array( 'db_insert_error' ) ) ) { |
|
152 | $post_id->add_data( array( 'status' => 500 ) ); |
|
153 | } else { |
|
154 | $post_id->add_data( array( 'status' => 400 ) ); |
|
155 | } |
|
156 | return $post_id; |
|
157 | } |
|
158 | $post->ID = $post_id; |
|
159 | ||
160 | $webhook = new WC_Webhook( $post_id ); |
|
@@ 254-261 (lines=8) @@ | ||
251 | ||
252 | // Convert the post object to an array, otherwise wp_update_post will expect non-escaped input. |
|
253 | $post_id = wp_update_post( (array) $post, true ); |
|
254 | if ( is_wp_error( $post_id ) ) { |
|
255 | if ( in_array( $post_id->get_error_code(), array( 'db_update_error' ) ) ) { |
|
256 | $post_id->add_data( array( 'status' => 500 ) ); |
|
257 | } else { |
|
258 | $post_id->add_data( array( 'status' => 400 ) ); |
|
259 | } |
|
260 | return $post_id; |
|
261 | } |
|
262 | ||
263 | $post = get_post( $post_id ); |
|
264 | $this->update_additional_fields_for_object( $post, $request ); |