diff --git a/includes/activitypub/collection/class-event-sources.php b/includes/activitypub/collection/class-event-sources.php index 21129ac..6710fb0 100644 --- a/includes/activitypub/collection/class-event-sources.php +++ b/includes/activitypub/collection/class-event-sources.php @@ -178,12 +178,23 @@ class Event_Sources { * * @param string $actor The Actor URL. * - * @return bool True on success, false on failure. + * @return WP_Post|false|null Post data on success, false or null on failure. */ public static function remove_event_source( $actor ) { - $actor = true; - self::delete_event_source_transients(); - return $actor; + $post_id = Event_Source::get_wp_post_from_activitypub_actor_id( $actor ); + + if ( ! $post_id ) { + return; + } + + $result = wp_delete_post( $post_id, true ); + + // If the deletion was successful delete all transients regarding event sources. + if ( $result ) { + self::delete_event_source_transients(); + } + + return $result; } /** @@ -292,18 +303,6 @@ class Event_Sources { return $event_sources; } - /** - * Remove a Follower. - * - * @param string $event_source The Actor URL. - * - * @return mixed True on success, false on failure. - */ - public static function remove( $event_source ) { - $post_id = Event_Source::get_wp_post_from_activitypub_actor_id( $event_source ); - return wp_delete_post( $post_id, true ); - } - /** * Queue a hook to run async. * diff --git a/includes/table/class-event-sources.php b/includes/table/class-event-sources.php index 9dcbf03..e8ecef5 100644 --- a/includes/table/class-event-sources.php +++ b/includes/table/class-event-sources.php @@ -228,7 +228,7 @@ class Event_Sources extends WP_List_Table { $event_sources = array( $event_sources ); } foreach ( $event_sources as $event_source ) { - Event_Sources_Collection::remove( $event_source ); + Event_Sources_Collection::remove_event_source( $event_source ); } } }