@@ 292-306 (lines=15) @@ | ||
289 | $result = wp_delete_post( $post_id ); |
|
290 | ||
291 | // If deleting fails... |
|
292 | if ( false === $result ) { |
|
293 | $post = get_post( $post_id ); |
|
294 | ||
295 | // ...and the post both exists and isn't in the trash... |
|
296 | if ( $post && 'trash' !== $post->post_status ) { |
|
297 | // ... then something went wrong. |
|
298 | return new WP_Error( |
|
299 | 'db_error', |
|
300 | sprintf( |
|
301 | __( 'Failed to delete post ID %d.', 'writing-on-github' ), |
|
302 | $post_id |
|
303 | ) |
|
304 | ); |
|
305 | } |
|
306 | } |
|
307 | ||
308 | return sprintf( |
|
309 | __( 'Successfully deleted post ID %d.', 'writing-on-github' ), |
|
@@ 318-332 (lines=15) @@ | ||
315 | $result = wp_delete_post( $post_id ); |
|
316 | ||
317 | // If deleting fails... |
|
318 | if ( false === $result ) { |
|
319 | $post = get_post( $post_id ); |
|
320 | ||
321 | // ...and the post both exists and isn't in the trash... |
|
322 | if ( $post && 'trash' !== $post->post_status ) { |
|
323 | // ... then something went wrong. |
|
324 | return new WP_Error( |
|
325 | 'db_error', |
|
326 | sprintf( |
|
327 | __( 'Failed to delete post ID %d.', 'writing-on-github' ), |
|
328 | $post_id |
|
329 | ) |
|
330 | ); |
|
331 | } |
|
332 | } |
|
333 | ||
334 | return sprintf( |
|
335 | __( 'Successfully deleted post ID %d.', 'writing-on-github' ), |