Advanced Ads offers a couple of filter hooks you can use to change settings, ad output or other things. To learn more about each hook you might take a look into the code or simply experiment a bit. You can learn more about filters from the add_filter page on wordpress.org.

advanced-ads-activate-advanced-js

Return true to force the advanced js library to be enqueued. Use by add-ons.

advanced-ads-ad-edit-allowed-metaboxes

Use this hook when you want to add new meta boxes to the ad edit screen. We prevent non-Advanced-Ads related meta boxes from showing up here.

advanced-ads-ad-health-display-fine

Manipulate the value of the variable that marks the Ad Health admin menu item as having or not having problems.

advanced-ads-ad-image-tag-attributes

Manipulate extra tag attributes for image ads.

advanced-ads-ad-image-tag-style

Manipulate style attribute for image ads.

advanced-ads-lazy-load-placement-offsets

Set an individual offset for the lazy load feature per placement. See this page for more details and an example.

advanced-ads-ad-list-allowed-columns

Define, which columns are allowed to show up in the ad list in the dashboard.

advanced-ads-ad-notices

Show ad specific notices on meta boxes on the ad edit screen.

advanced-ads-ad-output

Prepare frontend output. You can use the whole ad object with all its parameters to create the output

parameters:

  • string, output that was prepared based on the ad type
  • object, ad object

advanced-ads-ad-output-debug

Filter the output of the ad debug mode.

advanced-ads-ad-select-methods

Manipulate ad select methods.

advanced-ads-ad-select-args

Manipulate ad select arguments.

advanced-ads-ad-select-args

Change ad arguments like the display method or the id or add new arguments before the ad display method is started.

parameters:

  • array $args, array with arguments

advanced-ads-ad-select-methods

Ad additional ad selection methods. E.g. if the ad is displayed through a group, the method is group.

parameters:

  • array $methods, array with methods

advanced-ads-selling-email-options

Used to customize the content and additional attributes of emails sent by the Selling Ads add-on.

advanced-ads-ad-settings-pre-save

Manipulate ad settings before being saved.

advanced-ads-ad-types

Applied on an array of ad types. Can add or remove an ad type that later can be chosen when creating an add.

parameters:

  • array $types, array of ad types

advanced-ads-add-ons

Allow add-ons to register for automated update checks.

advanced-ads-admin-max-terms

Limits the number of terms and authors displayed on ad edit pages, e.g. when choosing categories where an ad should be displayed / hidden. If there are more than 50 authors or terms for a given taxonomie, you can only choose them using a search form.

  • int, default: 50

example (use in theme’s functions.php)

advanced-ads-bots

Change the list of blocked bots, user agents and web crawlers.

parameters:

  • array, list of user agent strings to block

advanced-ads-can-display

Add additional checks whether do display an ad or not.

parameters:

  • bool $can_display, whether to display or not an ad
  • object $ad, ad object

example (use in theme’s functions.php) using this hook to disable ads from non-posts

other notes

  • in case you don’t want to overwrite previous checks you should only explicitly return false, but if true simply return $can_display

advanced-ads-can-display-placement

Can be used to disable a placement using custom display conditions.

advanced-ads-can-inject-into-content

Can be used to suppress ad injection into the content if set to false.

advanced-ads-can-inject-into-content- $_placement_id

Can be used to suppress ad injection into the content based on the id of the placement.

advanced-ads-capabilities

Manage the list of available capabilities. Currently no use case.

advanced-ads-capability

Manage the output of an individual capability.

advanced-ads-conditions

(deprecated in favor of advanced-ads-display-conditions)

Add or remove ad conditions (conditions on where to display an ad).

parameters:

  • array, ad conditions

advanced-ads-custom-label

Adjust the markup of the label added optionally in front of the ads.

advanced-ads-dashboard-screens

Manage a list of admin pages that belong to Advanced Ads. Used to display relevant notifications or enqueue scripts only there.

advanced-ads-display-conditions

Add or remove display conditions.

advanced-ads-display-conditions-check-general

Add checks for custom conditions in the General Display Conditions.

advanced-ads-display-conditions-general

Add more conditions to the General Display Conditions.

advanced-ads-export

Manipulate the export.

advanced-ads-frontend-prefix

Adjust the frontend prefix setting, which can also be found through Advanced Ads > Settings > General.

advanced-ads-gadsense-ad-param-data

Allows modification of extra parameters used to render the ad param box. This hook shoud be fired on admin side but also when doing ajax calls.

  • module: gadsense

parameters:

  • arr $extra_params, array of extra parameters used to draw the content of the ad params meta box
  • obj $content, the ad content object
  • obj $ad, the ad object.

advanced-ads-gadsense-ad-param-script

Allows a modification of the list of scripts to be loaded on the ad edit page (every ad of type advanced_ads, not only AdSense).

  • module: gadsense

parameters:

  • array $scripts, associative array of scripts to enqueue on the ad edit page

advanced-ads-gadsense-ad-param-template

Allows a modification of the template file to include in the ad parameter metabox for an AdSense ad.

parameters:

  • string $default_template, full path to template file to load for ad parameters metabox
  • string $content, the post content for this ad (when editing an ad, empty string otherwise)

advanced-ads-gadsense-ad-param-style

Allows a modification of the list of css files to be loaded on the ad edit page

  • module: gadsense

parameters:

  • array $styles, similar to “advanced-ads-gadsense-ad-param-script” filter hook but for styling (.css files)

advanced-ads-gadsense-responsive-output

Allow modification of the output in the frontend. This filter is applied only if the ad is responsive. Should be used in conjunction with the advanced-ads-gadsense-responsive-sizing hook.

  • module: gadsense

parameters:

  • string $output, the front end output for the ad
  • object $ad, the ad object
  • string $pub_id, the AdSense account ID

advanced-ads-gadsense-responsive-sizing

Allows other plugins to use different resizing mode (horizontal, vertical, rectangle). Handling the frontend output, and the backend is left to the developer.

  • module: gadsense

parameters:

  • array $resizing, the default resizing mode for responsive ad (auto and manual CSS)

advanced-ads-geo-upload-dir

Change the upload subdirectory in which the databases are saved. Default is wp-content/uploads/advanced-ads-geo. You can change the /advanced-ads-geo part.

Example

advanced-ads-group-ad-count

Manipulate the number of ads displayed for a group. Used by the Slider add-on.

advanced-ads-group-output

Filter content of a random ad from an ad group. Remember, there are also filters for the ad content that will work before that.

parameters:

  • string $ad->content, the ad content
  • object $this, the ad group object

advanced-ads-group-output-ad-ids

Filter the groups ad ids and their order.

advanced-ads-group-output-array

Filter or manipulate the array with ad outputs before they get imploded. Can be used to alter the group output.

advanced-ads-group-save-atts

Filter additional group attributes before they are saved.

advanced-ads-group-types

Filter available ad group types. Could be used to add new ones.

parameters:

  • array $types, pre-defined group types

advanced-ads-headlines-for-ad-injection

Select headline levels for headline ad injection into content. Default: h2, h3 and h4.

advanced-ads-import

Manipulate import.

advanced-ads-list-ad-size

Allows modules to display alternative string for ad size in ads list if required (responsive ads with adsense ad types) when listing ads.

  • string $size, the size string to display in the ad list

parameters:

  • string $size, the size
  • object $ad, the ad object

advanced-ads-notices

Add or manipulate admin notifications.

advanced-ads-output-inside-wrapper

Change the ads output before the wrapper is added. E.g. use to add a custom wrapper or change content of the ad dynamically.

parameters:

  • string $output, ad content
  • object $ad, object

advanced-ads-output-final

Used to change or even override the individual ad output completely.

advanced-ads-output-wrapper-options

Manipulate wrapper options before the wrapper is build for output; don’t use in case you want to load these options into the ad object

parameters:

  • array $options, wrapper options of the ad
  • object $ad, ad object

example

This code will add a class _my-ad_ to the wrapper. You can use it in your themes functions.php or a custom plugin.

advanced-ads-output-wrapper-before-content

Runs inside the ad wrapper before the ad content.

parameters:

  • string, additional output before the ad content
  • object $ad, ad object

advanced-ads-output-wrapper-after-content

Runs inside the ad wrapper after the ad content.

parameters:

  • string, additional output after the ad content
  • object $ad, ad object

advanced-ads-placement-content-injection-items

Manipulate the items used by the Post Content placement for content injection.

advanced-ads-placement-content-injection-node

Manipulate the node used by the Post Content placement for content injection.

advanced-ads-placement-content-injection-options

Manipulate options for Post Content placement while injecting the ad into the content.

advanced-ads-placement-options-after-advanced

Attach advanced options for placements.

advanced-ads-placement-types

Change ad placement types available.

advanced-ads-plugin-locale

(deprecated)

Choose another plugin text domain locale.

advanced-ads-post-type-params

Change the ad post type.

advanced-ads-pre-ad-save-{type}

Filter ad content field before saving; based on ad type

parameters:

  • string $output, ad content that is to be saved in the db

advanced-ads-pro-background-selector

Adjust the element used to display the background for the background ad placement. You can find an example here.

advanced-ads-pro-inject-content-selector

Filter the content injection filter for placements in Pro. Written using jQuery selectors.

Example:

This would ignore the .other-wrapper when checking for available paragraphs and not inject into empty paragraphs.

advanced-ads-sanitize-condition-{type}

Sanitize a specific condition type before being saved

parameters:

  • condition value

There are some custom condition sanitize functions in the class, but you can also add new conditions with their own sanitize functions.

advanced-ads-sanitize-settings

Sanitize plugin settings before being saved.

advanced-ads-set-wrapper

Add wrapper options when ad is loaded

parameters:

  • array $options, wrapper options
  • object $ad, ad object

advanced-ads-setting-tabs

Add or manipulate setting tabs.

parameters:

  • array, options of default or already registered setting tabs

advanced-ads-support-messages

Messages shown on the support page in the plugin menu.

advanced-ads-tags-for-injection

Manipulate tags used by the Post Content placement for ad injection into the content.

advanced-ads-tracking-click-tracking-url

Change the click tracking URL created by Advanced Ads Tracking.

advanced-ads-tracking-redirect-url

Change the target URL when clicked on a tracking link.

advanced-ads-update-placements

Runs when placements are saved.

advanced-ads-visitor-conditions

Add or change visitor conditions.