Skip to content

Commit

Permalink
Merge pull request #3058 from jasonbahl/test/pr-with-bad-formatting
Browse files Browse the repository at this point in the history
fix: prevent wpml from redirecting in WPGraphQL requests
  • Loading branch information
jasonbahl committed May 30, 2024
2 parents 18a22f5 + 088a06b commit 30ee148
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/WPGraphQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,24 @@ static function ( $interfaces, $config, $type ) {
10,
3
);

/**
* Prevent WPML from redirecting within WPGraphQL requests
*
* @see https://github.com/wp-graphql/wp-graphql/issues/1626#issue-769089073
* @since @todo
*/
add_filter(
'wpml_is_redirected',
static function ( bool $is_redirect ) {
if ( is_graphql_request() ) {
return false;
}
return $is_redirect;
},
10,
1
);
}

/**
Expand Down

0 comments on commit 30ee148

Please sign in to comment.