Using the ad debug mode

The ad debug mode helps you (and us) to identify issues on your page that might interfere with displaying ads. The debug mode is especially useful if Display Conditions are not working as expected.

The issues below are often caused by broken code in other plugins or themes and are likely to cause issues not only with Advanced Ads. Fixing them is therefore in general advised.

Advanced Ads debug mode output


Example of an ad debug output

If you see one of the errors below, but are positive that everything is all right with your page and code then please contact us.

Enabling ad debug mode

You can find the debug mode in the Layout/Output meta box of the ad edit screen.

ad debug mode option

Once enabled, the output of the ad will be exchanged with the debug content.

Also, all display limitations for the ad will be ignored (display conditions, visitor conditions, expiry date).

The size of the debug ad is defined by the width and height you set for the ad and 300×250 if you didn’t set them. The content of the debug ad can be scrolled horizontally and vertically.

The debug mode does not work when the ad is delivered with Cache Busting.

Subscribe to our newsletter and get 2 add-ons for free!

* indicates required

Issues & Fixes

Please find issues listed in debug mode and possible fixes below.

General debugging

The debug output lists some general information that help you to see if you are in fact looking at the right ad and whether the general issues are fine or not, e.g.

  • whether the ad is displayed on the page or not (if debug mode is off)
  • name and ID of the current post
  • name and ID of the ad
  • current ad group
  • current placement

First, you should check if these information are in general correct.

You can display the ad debug mode to admins only by adding the following line to your wp-confic.php.

define( 'ADVANCED_ADS_AD_DEBUG_FOR_ADMIN_ONLY', true );

Debugging Conditions

Advanced Ads debug mode: display and visitor conditions

Debugging display and visitor conditions is done using the appropriate tables.

You will find the conditions set with the ad options in tables with three columns. The first column is about the type of the condition. The second about the options set with the ad and the third (wp_the_query) about the environment the ad is embedded into and the options are checked against.

The conditions are (currently) cryptic, but should be readable enough to identify them. If you see a non-matching line with 0 and 1 or empty and 1, it can be an indicator that conditions are not matching and this is the reason why an ad is not displayed.

Current query is not identical to main query.

This warning might occur, when the main query, the one that determines which page you are currently looking at (a single post, an archive, etc.) is altered. This might be intended, but is still often a hint for an incomplete usage of query_posts().

The solution is to place wp_reset_query(); after the query code.

Please note that the usage of query_posts() is often not needed or can or should be replaced with WP_Query or a filter. The documentation of query_posts() lists all the alternatives and their consequences.

If you are not the original developer of the code causing this then you can try placing this code to your theme’s functions.php.

Current post is not identical to main post.

This warning might occur, when other posts than the current one are requested, but the developer didn’t close that request properly. This is very common among plugins and widgets that show any type of featured posts (e.g., similar posts in the sidebar).

Note: Advanced Ads can automatically handle the consequences of this error in most cases. Still, errors might occur for some setups. Solving this is highly recommended also for other plugins to work properly.

If this error occurs together with the wrong-query error above, fix the query error first. It might solve the post error as well.

A possible cause of this problem is the use of WP_Query() with the_post() but without wp_reset_postdata();

Please refer to the manual of WP_Query for more information.

If you are not the original developer of the code causing this then you can try placing this code to your theme’s functions.php.

Make it better

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