Reputation: 5758
I am getting this error when I load up my Wordpress site:
Warning: include_once(../../plugins/acf-location-field-master/acf-location.php) [function.include-once]: failed to open stream: No such file or directory in C:\wamp\www\cmpmushrooms.tld\wp-content\themes\shrooms_v0.1\functions.php on line 455
The code it is referring to is this:
function my_register_fields()
{
include_once('../../plugins/acf-location-field-master/acf-location.php');
}
I realise it is saying it cannot find the file but why is that? because it exists in the directory.
Upvotes: 0
Views: 3210
Reputation: 11852
Why not:
include_once ( WP_PLUGIN_DIR . '/acf-location-field-master/acf-location.php');
Upvotes: 0
Reputation: 17944
You should do this way to include file from WP plugins directory :
include( plugin_dir_path( __FILE__ ) . 'plugin-name/file-name.php');
If you want to include all files within that directory, use it like this:
foreach ( glob( plugin_dir_path( __FILE__ )."plugin-name/*.php" ) as $file )
include_once $file;
Have fun :)
Upvotes: 1