DEV Community

Zaw Htut Win
Zaw Htut Win

Posted on • Updated on

Call to undefined function GuzzleHttp\Psr7\uri_for() - GuzzleHttp Conflict in Wordpress

This error occurred when there is plugins conflict. This is cause by guzzlehttp.

First find out how many plugins are there using. guzzlehttp.

In my case there are two, first one using guzzlehttp 7.0 and the latter using 6.4.1

Go to plugin directory and execute this command.

sudo find . -name "guzzlehttp" -type d
Enter fullscreen mode Exit fullscreen mode

Then you will see the results similar to this.

./woocommerce-xero/vendor/guzzlehttp
./wp-mail-smtp/vendor/guzzlehttp
Enter fullscreen mode Exit fullscreen mode

When this plugin is in conflict state, plugins effected can no longer detect the functions.php files in the vendor folder. So we need to make some adjustments to plugins:

In /home/gsc/gscwoo/wp-content/plugins/wp-mail-smtp/vendor/autoload.php

require_once(__DIR__.'/guzzlehttp/psr7/src/functions.php');
require_once(__DIR__.'/guzzlehttp/guzzle/src/functions.php');
require_once(__DIR__.'/guzzlehttp/promises/src/functions.php');
Enter fullscreen mode Exit fullscreen mode

In /home/gsc/gscwoo/wp-content/plugins/woocommerce-xero/vendor/guzzlehttp/guzzle/src/Client.php

require_once(ABSPATH.'/wp-content/plugins/woocommerce-xero/vendor/guzzlehttp/psr7/src/functions.php');
Enter fullscreen mode Exit fullscreen mode

Happy Coding!

Top comments (0)