I want to do something like: want to display one plugin’s page on other plugin’s page.
I have read Including file or library from other plugin
but its not working for me or either am doing something wrong
let say I want to use plugin-1 into plugin-2
here whats the meaning of
do_action( 'my_library_loaded', plugin_dir_path( __FILE__ ) );
plugin_dir_path( FILE ) path of which plugin (plugin-1 or plugin-2 ?) and where I have to put this? (in plugin-1 or plugin-2 ?)
same question for add_action( 'my_library_loaded', 'other_plugin_init_handler' );
any suggestion please
do_action()
orapply_filters()
.add_action()
oradd_filter()
.Basic example
Base plugin
Note the custom action
plugin_base_loaded
. This will be the anchor for all depending plugins.Now letâs create a second plugin that should run after the base has been loaded.
Addon plugin
This second plugin will not do anything if the base is not active. And if it is active, it will wait until the base has been loaded. Then it will print information about the base into the front-end footer.
You can see a broader example in my article Initialize a plugin with a configuration object, code examples, including an additional plugin, are on GiHub.