Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
515 views
in Plugins by
In some files of my plugin. I need to include a specific file (say `x`). I could use `include_once` in all plugin files that I need file `x` in them. But is there any better way to include this file once in plugin? and use in all plugin files happily?
Q2A version: 1.6.3

1 Answer

+1 vote
by
selected by
 
Best answer
You can include it from the qa-plugin.php file, which means the code from it will be available to all plugin files.

That's not the most efficient way though, because it will be included on every page load even if the plugin doesn't run. There is no problem with including it with include_once when you actually need to use it.
by
Thanks Scott. All qa-plugin.php files of all plugins call every time that q2a script run?
...