@@ -40,6 +40,9 @@ public static function init() {
4040 // Support Webmention delete
4141 add_action ( 'webmention_data_error ' , array ( static ::class, 'delete ' ) );
4242
43+ // Add scheduler for async processing
44+ add_action ( 'webmention_process_schedule ' , array ( static ::class, 'process ' ) );
45+
4346 self ::register_meta ();
4447 }
4548
@@ -215,10 +218,6 @@ public static function get( $request ) {
215218 * @param WP_REST_Request $request Full data about the request.
216219 *
217220 * @return WP_Error|WP_REST_Response
218- *
219- * @uses apply_filters calls "webmention_comment_data" on the comment data
220- * @uses apply_filters calls "webmention_update" on the comment data
221- * @uses apply_filters calls "webmention_success_message" on the success message
222221 */
223222 public static function post ( $ request ) {
224223 $ source = $ request ->get_param ( 'source ' );
@@ -317,6 +316,17 @@ public static function post( $request ) {
317316 return new WP_REST_Response ( $ return , 202 );
318317 }
319318
319+ return self ::process ( $ commentdata );
320+ }
321+
322+ /**
323+ * Process the Webmention.
324+ *
325+ * @param array $commentdata The comment data.
326+ *
327+ * @return WP_REST_Response|WP_Error The response or an error.
328+ */
329+ public static function process ( $ commentdata ) {
320330 /**
321331 * Filter Comment Data for Webmentions.
322332 *
0 commit comments