AdPresso provides filter hooks that let developers modify data, configuration and output without changing the plugin's core files.
Use these filters to customize anything from entity settings and placement behavior to frontend rendering, JavaScript configuration and integrations.
This reference lists the available AdPresso filters, their parameters, return values and practical usage examples.
adpresso_duplicate_post_statusFilters the default post status used when duplicating an entity (Ad, Group, or Placement).
'draft'string $status: The default status.WP_Post $post: The original post object.add_filter( 'adpresso_duplicate_post_status', function( $status, $post ) {
return 'pending';
}, 10, 2 );
adpresso_entity_quick_linksFilters the quick links displayed in the admin list tables for each entity.
array $links: Array of link data.AdPresso\Entities\Entity $entity: The entity object.add_filter( 'adpresso_entity_quick_links', function( $links, $entity ) {
$links['view_stats'] = [
'label' => 'View Stats',
'url' => admin_url( 'admin.php?page=adpresso-stats&id=' . $entity->get_id() ),
];
return $links;
}, 10, 2 );
adpresso_post_type_ad_argsadpresso_post_type_group_argsadpresso_register_post_type_placementFilters the registration arguments for AdPresso custom post types.
array $args: The registration arguments.add_filter( 'adpresso_post_type_ad_args', function( $args ) {
$args['show_in_rest'] = true;
return $args;
} );
adpresso/ads/fields/baseadpresso/groups/fields/baseadpresso/placements/fields/baseFilters the base fields (settings) for ads, groups, or placements.
array $fields: The base fields configuration.add_filter( 'adpresso/ads/fields/base', function( $fields ) {
$fields['internal_note'] = [
'label' => 'Internal Note',
'type' => 'textarea',
];
return $fields;
} );
adpresso_placement_type_fieldsFilters the fields for a specific placement type.
array $fields: The fields.string $type_id: The type ID.add_filter( 'adpresso_placement_type_fields', function( $fields, $type_id ) {
if ( $type_id === 'sidebar' ) {
$fields['sticky'] = [ 'label' => 'Sticky', 'type' => 'checkbox' ];
}
return $fields;
}, 10, 2 );
adpresso_placement_type_compatible_conditionsFilters the list of targeting condition IDs a Placement Type supports in the edit modal's Condition Builder. Return null (the default) for no restriction; return an array of condition IDs to narrow the catalog to only those. Embedded per-type into the same field config dependent_fields uses, so the React edit modal can react live to a Placement Type change without a REST refetch.
array|null $compatible_conditions: null for no restriction, or an array of allowed condition IDs.string $type_id: The placement type ID.add_filter( 'adpresso_placement_type_compatible_conditions', function( $compatible_conditions, $type_id ) {
if ( $type_id === 'my_custom_type' ) {
return [ 'device', 'browser_language' ];
}
return $compatible_conditions;
}, 10, 2 );
adpresso_placement_type_hidden_sectionsFilters the list of edit-modal section/box IDs to hide entirely for a Placement Type (e.g. the Layout box makes no sense for a type that's never rendered into a WordPress page's DOM). Returns an empty array by default (nothing hidden). Embedded per-type the same way as adpresso_placement_type_compatible_conditions, so the React edit modal reacts live to a Placement Type change without a REST refetch.
array $hidden_sections: Section/box IDs to hide (see Entity::get_edit_ui_sections()'s id, e.g. 'adpresso_layout').string $type_id: The placement type ID.add_filter( 'adpresso_placement_type_hidden_sections', function( $hidden_sections, $type_id ) {
if ( $type_id === 'my_custom_type' ) {
$hidden_sections[] = 'adpresso_layout';
}
return $hidden_sections;
}, 10, 2 );
adpresso_placement_fallback_fieldsFilters the fallback fields for placements when they are in a specific state.
array $fields: Fallback fields array.add_filter( 'adpresso_placement_fallback_fields', function( $fields ) {
$fields['custom_fallback'] = [ 'label' => 'Custom Fallback', 'type' => 'select', 'options' => [] ];
return $fields;
} );
adpresso_placement_rest_responseFilters a Placement's fully-assembled REST response data right before it's sent to the edit modal - e.g. to add type-specific fields, or to strip out UI data (like condition_builder_data entries) that don't apply to a particular placement type.
array $data: The prepared response data.AdPresso\Entities\Placement $placement: This placement.add_filter( 'adpresso_placement_rest_response', function( $data, $placement ) {
if ( $placement->get_type() === 'my_custom_type' ) {
$data['my_custom_field'] = 'some computed value';
}
return $data;
}, 10, 2 );
adpresso.output.wrapperApplied to the final HTML output of a placement.
string $html: The HTML output.AdPresso\Entities\Placement $placement: The placement entity.add_filter( 'adpresso.output.wrapper', function( $html, $placement ) {
return '<!-- Start Placement ' . $placement->get_id() . ' -->' . $html . '<!-- End -->';
}, 10, 2 );
adpresso.output.ad.wrapperApplied to the HTML output of an individual Ad.
string $html: The Ad HTML.AdPresso\Ads\Types\AbstractType $ad_type: The Ad type instance.add_filter( 'adpresso.output.ad.wrapper', function( $html, $ad_type ) {
return '<div class="adpresso-ad-item">' . $html . '</div>';
}, 10, 2 );
adpresso.output.placeholderFilters the placeholder HTML when a placement has no active ad to show.
string $html: The placeholder HTML.AdPresso\Entities\Placement $placement: The placement entity.add_filter( 'adpresso.output.placeholder', function( $html, $placement ) {
return '<div class="advertise-here"><a href="/advertise">Your Ad Here</a></div>';
}, 10, 2 );
adpresso_ssr_output_ad_contextadpresso_ssr_output_group_contextFilters the context data passed to an ad or group's output method during Server-Side Rendering (SSR).
array $context: Context information.AdPresso\Entities\Ad|AdPresso\Entities\Group $item: The entity.add_filter( 'adpresso_ssr_output_ad_context', function( $context, $ad ) {
$context['is_mobile'] = wp_is_mobile();
return $context;
}, 10, 2 );
adpresso_placement_js_configFilters the configuration data passed to the frontend JavaScript for a specific placement and item.
array $config: The configuration data.AdPresso\Entities\Placement $placement: The placement entity.AdPresso\Entities\Entity $item: The ad or group being rendered.add_filter( 'adpresso_placement_js_config', function( $config, $placement, $item ) {
$config['refreshInterval'] = 30000; // 30 seconds
return $config;
}, 10, 3 );
adpresso_ad_type_{type}_frontend_configFilters the frontend configuration for specific ad types (e.g., image, html, dummy).
array $config: The config data.AdPresso\Entities\Ad $ad: The ad entity.add_filter( 'adpresso_ad_type_image_frontend_config', function( $config, $ad ) {
$config['lazyLoad'] = true;
return $config;
}, 10, 2 );
adpresso_html_ad_allow_shortcodesDetermines if shortcodes should be processed in HTML ads.
bool $allow: Default true.AdPresso\Entities\Ad $ad: The ad entity.add_filter( 'adpresso_html_ad_allow_shortcodes', function( $allow, $ad ) {
// Disable shortcodes for a specific ad
if ( $ad->get_id() === 123 ) return false;
return $allow;
}, 10, 2 );
adpresso_content_filter_priorityFilters the priority of the the_content filter used for automatic injection.
100add_filter( 'adpresso_content_filter_priority', function() {
return 10; // Run earlier
} );
adpresso_dom_injectable_typesFilters the list of placement types that support DOM injection.
add_filter( 'adpresso_dom_injectable_types', function( $types ) {
$types[] = 'my_custom_type';
return $types;
} );
adpresso_list_table_columnsFilters the columns displayed in AdPresso list tables.
array $columns: The columns array.add_filter( 'adpresso_list_table_columns', function( $columns ) {
$columns['id'] = 'ID';
return $columns;
} );
adpresso_list_table_filtersFilters the available filters in the list table.
array $filters: The filters array.add_filter( 'adpresso_list_table_filters', function( $filters ) {
$filters['author'] = [ 'label' => 'Author', 'type' => 'select', 'options' => [] ];
return $filters;
} );
adpresso_list_table_bulk_actionsFilters the bulk actions available in the list table.
array $bulk_actions: The bulk actions array.add_filter( 'adpresso_list_table_bulk_actions', function( $actions ) {
$actions['export_csv'] = 'Export to CSV';
return $actions;
} );
adpresso_ad_metabox_classesadpresso_group_metabox_classesadpresso_placement_metabox_classesFilters the CSS classes applied to metaboxes in the admin.
add_filter( 'adpresso_ad_metabox_classes', function( $classes ) {
$classes['my-custom-box'] = 'custom-metabox-style';
return $classes;
} );
adpresso_script_dependenciesFilters the dependencies for AdPresso scripts.
array $deps: Dependencies.string $handle: Script handle.add_filter( 'adpresso_script_dependencies', function( $deps, $handle ) {
if ( $handle === 'adpresso-admin' ) {
$deps[] = 'jquery-ui-sortable';
}
return $deps;
}, 10, 2 );
adpresso_localize_admin_scriptsFilters data localized for admin scripts.
add_filter( 'adpresso_localize_admin_scripts', function( $data ) {
$data['my_param'] = 'my_value';
return $data;
} );
adpresso_disguisable_assetsFilters assets that can be disguised/obfuscated to avoid adblockers.
add_filter( 'adpresso_disguisable_assets', function( $assets ) {
$assets[] = 'custom-tracker.js';
return $assets;
} );
adpresso_settings_tabsFilters the registered settings tabs.
array $tabs: Array of SettingsTabInterface objects.add_filter( 'adpresso_settings_tabs', function( $tabs ) {
// Modify the tabs array
return $tabs;
} );
adpresso_tools_tabsFilters the tabs on the AdPresso Tools page.
array $tabs: Array of tab labels.add_filter( 'adpresso_tools_tabs', function( $tabs ) {
$tabs['my_tab'] = 'My Custom Tool';
return $tabs;
} );
adpresso_settings_tab_{tab_id}_optionsadpresso_tab_{tab_id}_optionsadpresso_tab_{tab_id}_sectionsDynamic filters to modify options and sections for specific settings tabs.
add_filter( 'adpresso_tab_general_options', function( $options, $tab ) {
$options['custom_field'] = [ 'label' => 'Custom Field', 'type' => 'text' ];
return $options;
}, 10, 2 );
adpresso_adblocker_tab_sectionsadpresso_adblocker_tab_optionsFilters specifically for the Adblocker settings tab.
adpresso_get_settingFilters a setting value when retrieved via the internal settings manager.
mixed $value: The value.string $key: Setting key.mixed $default: Default value.add_filter( 'adpresso_get_setting', function( $value, $key ) {
if ( $key === 'custom_api_key' ) return decrypt_value( $value );
return $value;
}, 10, 2 );
adpresso_importer_classesFilters the list of available importer classes.
add_filter( 'adpresso_importer_classes', function( $classes ) {
$classes[] = 'My_Custom_Importer';
return $classes;
} );
adpresso_export_settingsFilters the data to be exported.
add_filter( 'adpresso_export_settings', function( $data ) {
unset( $data['sensitive_data'] );
return $data;
} );
adpresso_is_globally_disabledFilters the result of the global disable check for AdPresso.
array $result: Array with 'disabled' (bool) and 'reason' (string).add_filter( 'adpresso_is_globally_disabled', function( $result ) {
if ( is_user_logged_in() && current_user_can( 'subscriber' ) ) {
$result['disabled'] = true;
$result['reason'] = 'Ads disabled for subscribers';
}
return $result;
} );
adpresso_requires_frontend_logicFilters whether a placement or entity requires frontend (JS) logic.
bool $requires: The current requirement status.AdPresso\Entities\Placement $placement: The placement entity.AdPresso\Entities\Entity $item: The ad or group item.add_filter( 'adpresso_requires_frontend_logic', function( $requires, $placement, $item ) {
// Force JS rendering for a specific placement
if ( $placement && $placement->get_slug() === 'js-only-placement' ) return true;
return $requires;
}, 10, 3 );
adpresso_global_gates_activeFilters whether any global, visitor-dependent gate (e.g. "Show ads for specific user roles", the Pro "Disable ads for bots" setting) is currently configured. Only ever inspects saved setting values, never the current request - used to decide whether the frontend's single, page-wide global-gates AJAX check is worth making at all.
bool $active: Whether a gate is active so far.add_filter( 'adpresso_global_gates_active', function( $active ) {
return $active || my_custom_gate_is_configured();
} );
adpresso_global_gate_blocks_visitorFilters whether the current visitor is blocked by any global gate. Only ever fires inside the uncached AJAX request that answers the frontend's global-gates check - never during normal page rendering - which is what makes it safe to inspect the actual current visitor/request here.
bool $blocked: Whether the visitor is blocked so far (should only ever change false to true, never override another gate's block back to false).add_filter( 'adpresso_global_gate_blocks_visitor', function( $blocked ) {
return $blocked || my_custom_gate_blocks_current_visitor();
} );
adpresso_get_capabilityFilters the capability required for a specific action.
string $cap: The capability.string $action: The action being performed.add_filter( 'adpresso_get_capability', function( $cap, $action ) {
if ( $action === 'manage_ads' ) return 'edit_posts';
return $cap;
}, 10, 2 );
adpresso_debug_mode_user_capFilters the capability required to see debug information.
'manage_options'add_filter( 'adpresso_debug_mode_user_cap', function() {
return 'edit_posts';
} );
adpresso_privacy_module_activeFilters whether the privacy module is considered active.
add_filter( 'adpresso_privacy_module_active', function( $active ) {
return true; // Force enable
} );
adpresso_condition_general_page_type_optionsadpresso_condition_page_template_post_typesadpresso_condition_parent_page_post_typesadpresso_condition_post_id_post_typesadpresso_condition_taxonomy_excluded_taxonomiesadpresso_condition_taxonomy_archive_optionsFilters used in various targeting conditions to define available options or restricted post types. adpresso_condition_taxonomy_excluded_taxonomies excludes taxonomy slugs from the auto-generated per-custom-taxonomy conditions (Category and Tag always get their own dedicated conditions regardless). adpresso_condition_taxonomy_archive_options filters the list of taxonomies offered by the "Taxonomy Archive" condition (Meta group) - checks whether the current page is the archive of one of the selected taxonomies; General Pages' own "Category Archive"/"Tag Archive" entries are hidden in favor of this condition but still evaluate correctly for conditions saved before the change.
adpresso_browser_lang_condition_languagesFilters the list of available languages for the browser language targeting condition.
adpresso/revisions/meta_keysadpresso/revisions/light_meta_keysFilters meta keys to be tracked in revisions.
add_filter( 'adpresso/revisions/meta_keys', function( $keys ) {
$keys[] = '_my_custom_meta';
return $keys;
} );
adpresso_global_fallbacksFilters the global fallback configuration.
adpresso_data_for_jsFilters the global data object passed to frontend JavaScript.
adpresso_enable_fast_trackingOpts into fast-track.php, a SHORTINIT-based tracking endpoint used instead of the adpresso/v1/track REST route for impression/click beacons. Off by default. The REST route is always kept as an automatic fallback (tracking.js falls back to it on any failure), so this is safe to toggle at any time. Equivalent to defining ADPRESSO_FAST_TRACKING as true in wp-config.php.
falseadd_filter( 'adpresso_enable_fast_tracking', '__return_true' );
Continue exploring the AdPresso developer documentation: