php - Wordpress - no such file or directory issue -


i getting error when load wordpress site:

warning: include_once(../../plugins/acf-location-field-master/acf-location.php) [function.include-once]: failed 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 referring this:

function my_register_fields() {     include_once('../../plugins/acf-location-field-master/acf-location.php'); } 

i realise saying cannot find file why that? because exists in directory.

you should way include file wp plugins directory :

include( plugin_dir_path( __file__ ) . 'plugin-name/file-name.php'); 

if want include files within directory, use this:

foreach ( glob( plugin_dir_path( __file__ )."plugin-name/*.php" ) $file )     include_once $file; 

have fun :)


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -