1. Home
  2. Docs
  3. Developer Documentations
  4. How to load a plugin functions

How to load a plugin functions

If there is function file used in a plugin, the name of the function file must be the name of the plugin. For example, if your plugin name is ‘test’, the name of the function file in the plugin must be ‘test.php’, and the function file is located in the ‘functions’ folder in the plugin directory. For example, if your plugin name is ‘test’, your function file will be located in this directory – plugins/test/functions/

All the functions in the function files in a particular plugin must be loaded for it to work. The file that load the functions is ‘loader.php’ located inside the plugin.

If for example the plugin name is ‘test’, to load the functions in a plugin function file, go to ‘loader.php’ in the test plugin directory and enter the following code:

load_functions('test::test');

The test:: is the name of the plugin in which the functions folder is located.
The test is the function filename.

Thank you for reading.

Was this article helpful to you? Yes No

How can we help?