Before running any code that modifies the behavior of Inventory Presser, make sure Inventory Presser is active. Check if the INVP
class exists.
💡 Plugins are not loaded until after the plugins_loaded
hook
Check if Inventory Presser is Active
<?php
if ( class_exists( 'INVP' ) )
{
//Inventory Presser is active
}
Check if Inventory Presser is Not Active
<?php
if ( ! class_exists( 'INVP' ) )
{
//Inventory Presser is not active
}
Action Hook After Inventory Presser Loads
The action hook invp_loaded
is run after Inventory Presser has completely loaded. This hook is useful to make sure add-on plugins do not load earlier than the core plugin.
<?php
add_action( 'invp_loaded', array( 'My_Addon_Loader', 'load' ) );
class My_Addon_Loader
{
public static function load()
{
require_once( __DIR__ . '/includes/class-addon.php' );
$addon = new My_Addon();
$addon->add_hooks();
}
}