Question

I have a processForm.php in theme directory that does what it says. I am trying to include a file (which i need in order to run a specific function in processform.php) from a plugin directory and have been unable to do so. As suggested in first solution in this thread I tried :

include( plugin_dir_path( __FILE__ ) . 'test-plugin/needed_file.php'); 

I was pretty sure this would work but unfortunately it throw a warning like so :

Warning: include(/home2/xxx/public_html/wp-content/themes/xxx/test-plugin/needed_file.php) [function.include]: failed to open stream: No such file or directory 

As said earlier the processForm.php lies in the theme directory and I have no issues anywhere else, calling files within the template directory. If this may help, there is alos a constant defined for this particular plugin's path which goes like this :

define('WPFP_PATH', plugins_url() . '/test-plugin'); 

So in accordance to a solution suggested here, I tried using code below :

include(WPFP_PATH . '/needed_file.php');

Unfortunately it throws three types of warning :

First warning :

http:// wrapper is disabled in the server configuration by allow_url_include=0 

Second warning :

failed to open stream: no suitable wrapper could be found in....

Third warning :

Failed opening 'http://awesomeness.com/wp-content/plugins/test-plugin/needed_file.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in.....

So the bottomline is How do I include this file into my processForm.php ( which is in root of theme directory).

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top