Constants

These are the constants that are used or can be used with Advanced Ads. Most of these constants can just be defined in your site’s wp-config.php file with a single line like this:

define( 'ADVANCED_ADS_PRO_REFERRER_EXDAYS', 0 );

If one of the following Advanced Ads constants is enabled on your website, you will see the notice Advanced Ads related constants enabled_ in your backend.

ADVADS_ADS_DISABLED

You can set the ADVADS_ADS_DISABLED constant to disable all ads at a certain point when building the frontend output of your website.

Advanced Ads also set’s this constant when options like Disable all ads in the frontend are selected in the plugin settings.

There is no need to set it to false explicitly.

Sample code you can use to set the constant: (always test if it already exists!)

if(!defined('ADVADS_ADS_DISABLED')){
    define('ADVADS_ADS_DISABLED', true);
};Code language: JavaScript (javascript)

ADVADS_ALLOW_ADSENSE_ON_404

Set this constant in your wp-config.php file in order to allow Google AdSense ads to appear on 404 error pages.

ADVADS_BASE_PATH

Basic plugin path.

ADVADS_BASE_URL

Basic plugin URL.

ADVADS_CURRENT_CONTENT_LENGTH

Included in Advanced Ads Pro.

Length of the content when ad injection is used.

ADVADS_DISABLE_RESPONSIVE_IMAGES

Set this constant if you don’t want to create responsive images for image ads and images in rich content ads as introduced in WordPress 4.4.

Since WordPress 5.5, this constant also disables lazy loading of images in the ad content. This relates to the WordPress-native lazy loading technology, not Lazy Loading in Advanced Ads Pro.

ADVADS_SLUG

Slug and textdomain used in many places to identify the plugin.

ADVANCED_ADS_AD_DEBUG_FOR_ADMIN_ONLY

Define this constant with any value and only ad admin users will see the ad debug output.

ADVANCED_ADS_DISABLE_ANALYTICS_ANONYMIZE_IP

Set this contant if you don’t want anonymizeIp enabled by default with Analytics tracking features.

ADVANCED_ADS_DISABLE_CHANGE

Set this constant in order to prevent overriding attributes in the theme PHP functions or shortcodes to work.

ADVANCED_ADS_DISABLE_CODE_HIGHLIGHTING

Set this constant to disable code highlighting in the plain text ad type.

ADVANCED_ADS_DISABLE_EDIT_BAR

Set to disable the frontend edit button. When defined, the edit button will not show for logged-in users. The value is not important.

define( 'ADVANCED_ADS_DISABLE_EDIT_BAR', true );Code language: JavaScript (javascript)

ADVANCED_ADS_DISABLE_FRONTEND_AD_WEIGHT_UPDATE

Removed in Advanced Ads 1.30.0. We found an automatic solution for the issue.

Set this constant in order to disable ad group weight updates in the frontend. Only on very high traffic sites, it can happen that the ad weights get overridden through a frontend call while an admin saves them in the admin area, so the old value is restored and the update has no effect.

ADVANCED_ADS_DISABLE_SHORTCODE_BUTTON

Remove the shortcode icon from the TinyMCE interface for all users.

ADVANCED_ADS_DISALLOW_PHP

Set this constant to remove the option to use and execute PHP within ad code.

ADVANCED_ADS_ENABLE_REVISIONS

Set this constant in order to allow revisions for ads (only ad content).

ADVANCED_ADS_LOG_ADSENSE_API

Log requests to Google AdSense API in wp-content/advanced-ads-google-api-requests.log .

ADVANCED_ADS_PRO_CUSTOM_CONTENT_FILTER

Allow applying content injection to a custom filter.

See an example here.

ADVANCED_ADS_PRO_CUSTOM_POSITION_MOVE_INTO_HIDDEN

Set this constant in order to allow the injection of ads into hidden elements. Especially meant for the Custom Position placement.

ADVANCED_ADS_PRO_PAGE_IMPR_EXDAYS

Set the cookie duration of the page impressions visitor condition in Advanced Ads Pro in days. Default: 3650 days (10 years).

The following example would change the default cookie duration to 365 days (1 year).

define( 'ADVANCED_ADS_PRO_PAGE_IMPR_EXDAYS', 365 );
Code language: JavaScript (javascript)

ADVANCED_ADS_PRO_REFERRER_EXDAYS

Set the cookie duration of the URL referrer visitor condition in Advanced Ads Pro in days. Default: 365 days.

Set the cookie duration of the visitor profile cookie in seconds. Default 2592000 seconds (30 days).

ADVANCED_ADS_RESPONSIVE_DISABLE_BROWSER_WIDTH

Set to true disables the Browser Width visitor condition in Advanced Ads Pro.

ADVANCED_ADS_SELLING_SHOW_SETUP_FORM_AFTER_CONTENT

Relates to Selling Ads.

Set this constant to show the ad setup form after the content when a specific page is selected instead of in front of it.

ADVANCED_ADS_SHOW_LICENSE_RESPONSE

Set this constant to show license debug information in Advanced Ads > Settings > Licenses when trying to enable or disable a license. It will prevent the license activation to work, so remove it if no longer needed.

ADVANCED_ADS_SUPPRESS_PLUGIN_ERROR_NOTICES

Don’t show critical plugin errors in WordPress Admin.

ADVANCED_ADS_TRACKING_DEBUG

Define this constant in order to activate a tracking debug log. Find more details under Debug tracking here.

ADVANCED_ADS_TRACKING_FORCE_ANALYTICS

Set to true to enable Tracking ads with Google Analytics and another tracking method at the same time as described here.

ADVANCED_ADS_TRACKING_LEGACY_AJAX

This constant needs to be set if your web server prevents the default Frontend tracking method from working. See this section for more details.

define( 'ADVANCED_ADS_TRACKING_LEGACY_AJAX', true );Code language: JavaScript (javascript)

ADVANCED_ADS_TRACKING_NO_HOURLY_LIMIT

Set this constant to avoid spreading impressions and clicks over a given period when an impression or click limit and expiry date is set.

ADVANCED_ADS_TRACKING_NO_PUBLIC_STATS

Don’t generate a public stats page per ad.

ADVANCED_ADS_TRACKING_IGNORE_LOGGED_IN_USERS

Don’t track any activity from logged-in users. Needs to be true.

define( 'ADVANCED_ADS_TRACKING_IGNORE_LOGGED_IN_USERS', true );Code language: JavaScript (javascript)

Make it better

Increase your ad management skills without spending more time.
Join over 150,000 publishers and AdOpts increasing their ad revenue.