Description
This hook is called once all the MediaPress core files has been loaded. Developers should use this hook to load the files for MediaPress dependent plugin. It is the first action hook that fires after MediaPress is loaded.
Parameters
There are no arguments passed to this hook.
Usage
1 | <?php add_action( 'mpp_loaded', 'function_name' ); ?> |
Examples
The code shows how to use this hook to load files for the MediaPress dependent plugin addons.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | add_action( 'mpp_loaded', 'mpp_addon_my_plugin_load_files' ); /** * Assuming that we are writing a MediaPress addon named mpp-addon-my-plugin * * we can put the following code in our addon plugin's main file. * It loads the given files from our addon plugin * * in this example, it loades mpp-addon-my-plugin/core/functions.php * and mpp-addon-my-plugin/core/actions.php * * Feel free to adapt the code for your purpose * */ function mpp_addon_my_plugin_load_files() { $path = plugin_dir_path( __FILE__ ); $files_to_load = array( 'core/functions.php', //wp-content/plugins/mpp-addon-my-plugin/core/functions.php 'core/actions.php', ); foreach( $files_to_load as $file ) { require_once $path . $file ; } //your plugins files got loaded } |
Changelog
- Since 1.0.0
Source
medisapress/mediapress.php