How to Call Function From Separate WordPress Install on Same Server?

Your include path is incorrect.

You have:

require_once( dirname(__FILE__) . '../../../../global_functions.php');

When it should be:

require_once( dirname(__FILE__) . '../../../../functions/global_functions.php');


The other alternative would be to change your setup from individual standalone installations of WordPress to WordPress Multi-site.

You would then have a couple of options:

  1. Option #1 being a Must-Use Plugin.
  2. Option #2 being a standard Plugin (Activated network-wide).
  3. Option #3 being a standard Plugin (Activated on a per-site basis).

Personally, I would recommend option #1 (Must-Use plugin). This will activate the plugin across every site in your network and it can’t be deactivated or removed via user interface. This guarantees the code will be available for all sites in your network at all times.

Option #2 is nice, because it does exactly the same as option #1, except if you want to troubleshoot what might be causing a problem, you can very easily activate or deactivate the functionality with a simple click through the administrative user interface.

Option #3 is a bit more versatile. You can activate the plugin on a per-site basis. Maybe you have three sites to manage, but only two of them need the functionality. Then you can activate it on just those two sites and not the third one.

Either way, which ever option you choose (related to WordPress multi-site), you only have to manage the functionality in one place, while multiple sites can share and use that functionality.