calling custom function from non wordpress php file
-
i’m learning php and created my own php file. if i call the main function within that php file and load it, it works. such as:
mainfunction('var', 1);it successfully writes the expected text to the browser window.
if i remove that main function call from that php file itself and add it to a .html page in the same directory like this:<body> <?php include("filename.php"); ?> <?php mainfunction('var', 1); ?> </body>and then load that .html file, nothing happens… no errors, no text is written to screen, etc. changing “include” to “require” does nothing different.
if i add the comments to the top of my php file to turn it into a wp-plugin and activate it, then call the function the same way, it works.
what am i missing?
thanks!
The topic ‘calling custom function from non wordpress php file’ is closed to new replies.