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