I am trying to include a file in an another file, but nothing. No error. First I included my main file.
include('inc/onefolder/mymainfile.php');
And then I try to include secondary files in this file (mymainfile.php
).
include('inc/onefolder/anotherfolder/secondaryfile.php');
When you use PHP
include
orrequire
in a WordPress plugin is a good idea to use WordPress specific functions to get the absolute path of the file. You can use plugin_dir_path:Plugins directory is not always at wp-content/plugins as we can read in WordPress Codex:
So, using plugin_dir_path() assures that
include
will always point to the right path.try to include absolute path of your file.
Use it:
in your case:
Hope it will help.
Edit:
Check it out, please note, you should give the exact path as written on above line. Make it clear.