@@ 275-289 (lines=15) @@ | ||
272 | $result = wp_delete_post( $post_id ); |
|
273 | ||
274 | // If deleting fails... |
|
275 | if ( false === $result ) { |
|
276 | $post = get_post( $post_id ); |
|
277 | ||
278 | // ...and the post both exists and isn't in the trash... |
|
279 | if ( $post && 'trash' !== $post->post_status ) { |
|
280 | // ... then something went wrong. |
|
281 | return new WP_Error( |
|
282 | 'db_error', |
|
283 | sprintf( |
|
284 | __( 'Failed to delete post ID %d.', 'writing-on-github' ), |
|
285 | $post_id |
|
286 | ) |
|
287 | ); |
|
288 | } |
|
289 | } |
|
290 | ||
291 | return sprintf( |
|
292 | __( 'Successfully deleted post ID %d.', 'writing-on-github' ), |
|
@@ 301-315 (lines=15) @@ | ||
298 | $result = wp_delete_post( $post_id ); |
|
299 | ||
300 | // If deleting fails... |
|
301 | if ( false === $result ) { |
|
302 | $post = get_post( $post_id ); |
|
303 | ||
304 | // ...and the post both exists and isn't in the trash... |
|
305 | if ( $post && 'trash' !== $post->post_status ) { |
|
306 | // ... then something went wrong. |
|
307 | return new WP_Error( |
|
308 | 'db_error', |
|
309 | sprintf( |
|
310 | __( 'Failed to delete post ID %d.', 'writing-on-github' ), |
|
311 | $post_id |
|
312 | ) |
|
313 | ); |
|
314 | } |
|
315 | } |
|
316 | ||
317 | return sprintf( |
|
318 | __( 'Successfully deleted post ID %d.', 'writing-on-github' ), |