Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

Where the library files need to be placed?

share|improve this question

2 Answers 2

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

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:

http://tgmpluginactivation.com/

share|improve this answer

Your Answer

 
discard

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.