diff --git a/sender.php b/sender.php index c3fb3b2..c7f0634 100644 --- a/sender.php +++ b/sender.php @@ -119,7 +119,8 @@ class WP_Webmention_Again_Sender extends WP_Webmention_Again { return false; } - if ( 'publish' != $new_status ) { + // send delete messages when trashed + if ( 'publish' != $new_status || 'trash' != $new_status ) { return false; } else { diff --git a/wp-webmention-again.php b/wp-webmention-again.php index e708a8d..eb5da14 100644 --- a/wp-webmention-again.php +++ b/wp-webmention-again.php @@ -88,6 +88,24 @@ class WP_Webmention_Again { // extend current cron schedules with our entry add_filter( 'cron_schedules', array(&$this, 'add_cron_schedule' ) ); + static::lookfordeleted(); + + } + + public static function lookfordeleted() { + $url = substr( rtrim( ltrim( $_SERVER['REQUEST_URI'], '/' ), '/' ), 0, 191 ) . '__trashed'; + $query = new WP_Query( array ( + 'name' => $url, + 'post_status' => 'trash', + 'post_type' => 'any' + )); + + if ( ! empty( $query->posts ) && $query->is_singular ) { + status_header(410); + nocache_headers(); + die('This post was removed.'); + } + } /**