Skip to content

Commit 55cd087

Browse files
committed
Update WebhookEventManager.php
1 parent 660de70 commit 55cd087

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

plugins/wp-graphql-headless-webhooks/src/Events/WebhookEventManager.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,15 @@ public function register_hooks(): void {
5858
private function trigger_webhooks( string $event, array $payload ): void {
5959
$allowed_events = $this->repository->get_allowed_events();
6060

61-
if ( ! in_array( $event, $allowed_events, true ) ) {
61+
if ( ! array_key_exists( $event, $allowed_events ) ) {
6262
return;
6363
}
6464

6565
do_action( 'graphql_webhooks_before_trigger', $event, $payload );
6666

67-
foreach ( $this->repository->get_all() as $webhook ) {
67+
$webhooks = $this->repository->get_all();
68+
69+
foreach ( $webhooks as $webhook ) {
6870
if ( $webhook->event === $event ) {
6971
$this->handler->handle( $webhook, $payload );
7072
}

0 commit comments

Comments
 (0)