Inside one of small custom plugins I really need to inlcude a file from another plugin, in order to be able to create and save obhect of a class that is declared there.

What I have tried and the closest is this:


The error I get in the debug logs is the following:

PHP Warning:  include_once(http://.../plugin-name/classes/event.php): failed to open stream: no suitable wrapper could be found in ..

I wonder what would be the correct way to reuse the logic of that class to only be able to create and save objects.

Any help or guidance is much appreciated.


1 Answer 1


Including a PHP file requires to provide its exact file path, not the URL.

Try this instead:

include_once( WP_PLUGIN_DIR . '/plugin-name/classes/event.php' );

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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