AdPresso provides action hooks that let developers run custom code at specific points throughout the plugin lifecycle.
Use these actions to extend AdPresso without modifying its core files — for example, to register custom conditions or entity types, react to saved ads, integrate external functionality or hook into AdPresso's initialization process.
This reference lists the available AdPresso action hooks, their parameters and practical usage examples.
adpresso.loadedFires after AdPresso has finished booting.
AdPresso\Plugin $plugin: Main plugin instance.add_action( 'adpresso.loaded', function( $plugin ) {
// Plugin is ready
} );
adpresso_register_entitiesAction to register custom entities during plugin boot.
add_action( 'adpresso_register_entities', function( $registrar ) {
// Register custom entities here
} );
adpresso_ad_types_registeredadpresso_group_types_registeredadpresso_placement_types_registeredAction fired after core types are registered.
add_action( 'adpresso_ad_types_registered', function( $registry ) {
$registry->register( new My_Custom_Ad_Type() );
} );
adpresso_register_conditionsAllows developers to register custom targeting conditions.
add_action( 'adpresso_register_conditions', function( $registry ) {
$registry->register( new My_Custom_Condition() );
} );
adpresso_ad_savedFires once an ad's post AND its meta_data are both fully persisted for a save - unlike core's save_post (which fires from inside AdRepository::save()'s wp_insert_post() call, before that same save's meta_data is written), so listeners see the values just submitted, not whatever was there before this save.
int $post_id: The ad's post ID.int $previous_image_id: The ad's image_id meta value before this save (0 if none/new ad) - lets a listener detect an image change and act on the old value before it's gone.add_action( 'adpresso_ad_saved', function( $post_id, $previous_image_id ) {
// React to a fully-saved ad, e.g. compare against $previous_image_id
}, 10, 2 );
adpresso_register_assetsFires when assets should be registered.
adpresso_load_integrationsFires when integrations should be loaded.
adpresso_load_rest_controllersFires when REST controllers should be registered.
adpresso_pro_bootedFires after AdPresso Pro has booted.
adpresso-admin-menu-initFires when the admin menu is being initialized.
add_action( 'adpresso-admin-menu-init', function( $admin_menu ) {
// Add custom menu items
} );
adpresso/settings/form/beforeadpresso/settings/form/{tab_id}/endadpresso/settings/form/{tab_id}/afterActions fired around the settings form.
add_action( 'adpresso/settings/form/general/after', function() {
echo '<p>Additional info for general settings</p>';
} );
adpresso/settings/page/{page_id}/beforeadpresso/settings/page/{page_id}/afterActions fired around specific settings pages.
adpresso/settings/section/{section_id}/beforeadpresso/settings/section/{section_id}/afterActions fired around specific settings sections.
adpresso/settings/field/{field_id}/beforeadpresso/settings/field/{field_id}/afterActions fired around individual settings fields.
add_action( 'adpresso/settings/field/ad_name/before', function( $field ) {
echo '<p>Choose a unique name for your ad.</p>';
} );
adpresso_tools_render_tab_{tab_id}Fires to render a specific tool tab.
add_action( 'adpresso_tools_render_tab_my_tab', function() {
echo '<h2>My Custom Tool</h2>';
} );
adpresso_after_settings_tab_registeredFires after a settings tab has been registered.
adpresso_after_duplicate_entityAction fired after an entity has been successfully duplicated.
int $new_post_id: ID of the new post.int $original_id: ID of the original post.add_action( 'adpresso_after_duplicate_entity', function( $new_id, $old_id ) {
// Handle custom meta duplication
}, 10, 2 );
adpresso_after_register_ad_post_typeFires after the ad post type is registered.
adpresso_clear_page_cacheFires when page cache should be cleared (e.g., after saving an ad).
add_action( 'adpresso_clear_page_cache', function() {
if ( function_exists( 'w3tc_flush_all' ) ) w3tc_flush_all();
} );
Continue exploring the AdPresso developer documentation: