Load a php file in a function call

I am developing a plugin. In the function call I want to load different PHP scripts. I tried using include("filename.php").

The scenario is that a function is called in PHP for an Ajax post method. In this function I want to load a PHP file.

Read More

Can anyone tell me how to get this to work?


Update – Got it working by using include(/folder1/filename.php) no need to specify the whole
path.

Related posts

Leave a Reply

1 comment

  1. The syntax for file inclusion (either by include() or require() ) should be:

    include(dirname( plugin_basename( __FILE__ ) ) . '/your-php-file.php');
    

    if the file you want to include is in the same folder as your plugin’s main file.