I did some search about this but I don't realize which is the correct way to include a wordpress core file into a plugin.

I wish to include the wp-includes/ms-funcition.php file.

For example if I use include_once('../../../wp-includes/ms-functions.php') it wont load.

Any suggestions? Thank you very much.


Most of the time, if you are doing things right you don't have to include Core files. If you are doing things right they will already be loaded for you. In those case where they aren't loaded, trying to load files with "directory traversal" paths is the wrong way. The Core constants ABSPATH and WPINC should give you the base path the the includes directory.

var_dump(ABSPATH . WPINC);

Just tack on the rest of address.

The Core function includes_url() will help if you need the URL instead of the path.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.