I'm trying to write a plugin with multi files. I'm sure I did it before without a problem, but now I have the problem in the subject.
In the main plugin file I have included a file name -
ydp-includes.php. Inside of
ydp-includes.php I have included all the files I wanted like this:
<?php include(dirname( __FILE__ ) .'/1.php'); include(dirname( __FILE__ ) .'/2.php'); include(dirname( __FILE__ ) .'/3.php'); include(dirname( __FILE__ ) .'/4.php'); ?>
but I'm getting:
Fatal error: Call to undefined function add_action().
The files are included, but for a reason I can't see at the moment, wordpress doesn't see them as one plugin package and each wordpress function inside ignored.
Is there another best practice way to develop multiple files wordpress plugin? What am I doing wrong?