WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I make an external PHP library available with my plugin.

Where the library files need to be placed?

share|improve this question

There is no central library folder for WordPress like you have for drupal. So you just include the library files within your plugin's folder and use the function plugin_dir_path to figure out the include path.

Another alternative is to distribute the library files as a separate plugin and then use TGM plugin activation to "require" that plugin:


share|improve this answer

The best way to include an external library is to put it in your plugins folder. Then just use require_once() wherever you need it. Depending on the size of the plugin and your type of programing this might be in the main plugin file or wherever you need that functionality.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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