0

Do they know if there is a way to call a Wordpress functions and functions of some plugins thereof, from a different directory it was installed Wordpress, but all on the same server?

Thank you! :)

sgb004
  • 347
  • 4
  • 14
  • you need to use `include` or `require` to fetch those files, where these functions are, but do not do this. this is a really bad practice. – vaso123 Nov 27 '14 at 16:09
  • I also think it is a bad practice, maybe use admin-ajax.php?action= and file_get_contents with stream_context_create, but I think that too it is a bad practice, because the calls are in the same server – sgb004 Nov 27 '14 at 16:43

1 Answers1

1

The solution to your problem is this piece of code:

require_once("../../../../wp-load.php");

Keep in mind that not all WP installations have the same folder structure, the example above starts from a folder inside the theme directory, so you might need to add or remove "../".

This is, however, not a very good practice because it overwrites WP core functions.

Also, this question was already asked before many times, for example here.

Community
  • 1
  • 1
nunorbatista
  • 868
  • 2
  • 11
  • 19