Additional Block Settings
Button Misc below the code editor opens tabs for additional block settings.
Setting are divided into tabs.
[ADINSERTER AMP] separator to insert special AMP code on AMP pages.
Similarly, by default code blocks will not be inserted on Error 404 page (Page Not Found) and into RSS feeds. Check Error 404 Page or RSS Feed checkbox to enable insertion there. Ajax requests (e.g. for infinite scroll) are by default enabled, but you can uncheck option to disable insertion on Ajax calls.
For each code block you can limit how many times on the page the block (or ad) will be inserted. There are two settings for this. Max N insertions: this is a simple limit for the first N insertions for the block. You can also limit maximum number of blocks per page. This limit is defined on the general plugin settings page (tab ⚙ / tab General). If you want this block to count for maximum blocks per page check Max blocks per page.
Make sure the theme calls
the_content filter to process content sent via Ajax calls. Otherwise the plugin will not be able to insert anything into content for infinite scroll.
Each code block can be inserted for:
- All users (default)
- Logged in users
- Not logged in users
- Administrators (useful for testing / debugging)
If you are using caching user check may not work as expected. The check works only when the page is generated and Ad Inserter is called. Make sure you set caching plugin to not cache pages for known (logged in users) or disable caching for this block when you are using this setting. Check Caching section for details.
Insert only in the loop inserts the block only when WordPress function
in_the_loop () returns true – the WordPress loop is currently active. This setting is useful to optimize plugin processing time and to avoid counting block insertions when
the_content hook is not called to process the main post or page content.
Many themes call
the_content hook (to process post or page content) more than once. Usually only the last call is actually used to insert ads into post or page. Additional call may be used to process other content the theme displays on the page. In such cases all calls to
the_content hook except the last one cause increased plugin processing time and also increase block insertion counters. In order to have accurate block insertion counters and to optimize plugin processing time you can enable setting Insert only in the loop.
Use debugging function Log processing to see how many times the content hook is called and how many times the blocks are inserted. You can also see content and block counter when the blocks are labeled. In the following example Block 1 was configured to insert after paragraphs 2 and 4. However, because the content hook was called 3 times (
C=3) the actual inserted blocks have block counters
Enabling Insert only in the loop would keep block counters to 1 and 2 despite the content hook is called 3 times.
Similar effect can be achieved with Filter set to 3 and filter counter set to Content processing. However, the content processing counters may change when you change theme.
There is also an option to disable caching on specific pages. This option will prevent caching of pages where code blocks with this option enabled are inserted. This option works with WP Super Cache, W3 Total Cache and WP Rocket caching plugins. After you enable this option make sure you flush the cache.
You can define when the code block will be inserted:
- Insert immediately: no scheduling
- Delay insertion for N days after publishing: waits for N days after the time when the post was published. Available only for insertion in posts.
- Insert only for N days after publishing: inserts only for N days after the time when the post was published. Available only for insertion in posts.
- PRO Insert between dates START-DATE and END-DATE: inserts code only between START-DATE (including) and END-DATE (excluding) – on START-DATE it starts inserting, on END-DATE it ends inserting. You can also define fallback code block to be inserted when the scheduled block expires.
- PRO Insert outside dates START-DATE and END-DATE: inserts code only outside START-DATE (excluding) and END-DATE (including) – on START-DATE it stops inserting, on END-DATE it starts inserting again. You can also define fallback code block to be inserted when the scheduled block is not inserted.
- PRO Insert for posts published between dates START-DATE and END-DATE: inserts code only for posts published between START_DATE (including) and END_DATE (excluding) – on publishing date START-DATE it starts inserting, on publishing date END-DATE it ends inserting. You can also define fallback code block to be inserted when the scheduled block is not inserted. Available only for insertion in posts.
- PRO Insert for posts published outside dates START-DATE and END-DATE: inserts code only for posts published before START-DATE (excluding) or after END-DATE (including) – on publishing date START-DATE it stops inserting, on publishing date END-DATE it starts inserting again. You can also define fallback code block to be inserted when the scheduled block is not inserted. Available only for insertion in posts.
If you are using caching you need to take into account also the page caching time.
Here you can enable Ad label (usually Advertisements) above the ad as it is defined under general plugin options (tab ⚙ / tab General / Ad label). You can define only label text or complete HTML code for the label.
PRO You can also enable Lazy loading. Lazy loading means that the code block (ad) is not loaded (inserted) until it is visible in the viewport (or it is close to become visible). This may decrease impressions for that block as the impression is not counted until the ad is actually loaded and it is not loaded until the page is scrolled to make this ad visible.
How close to the viewport (in pixels) the ad must be in order to be loaded can be defined on the general plugin settings (tab ⚙ / tab General / Lazy loading offset).
PRO Code blocks can have close button. Useful mainly for sticky ads. Choose corner position of the close button. This setting is also available on the sticky ad animation settings.
For post and static pages you can define minimum and maximum number of words. Empty value means no limit.
This works only on single pages.
Filter is a very powerful tool to define precisely where the block should be inserted. In case the block is (because of other settings) inserted more than once on the page you can limit wanted insertions by specifying the number or comma separated list of numbers of wanted insertions.
For example, when using Between posts automatic insertion, Filter set to
2, 4, 6 means insertion after posts 2, 4, and 6.
Alternatively you can leave Filter field empty (means all insertions) and define maximum number of insertions (tab Insertion) which is equivalent to Filter
1, 2, 3, …, N.
Filter insertions – define which insertions are enabled – single number or
%N which means every N-th insertion. You can also specify comma separated list of numbers.
This is useful in many cases where you can’t remove unwanted insertions of the code with other settings. For example:
- If you need to insert ad before the first, third and fifth excerpt on the homepage you simply specify 1, 3, 5 for the filter.
- If you need to insert an ad between the second and third comment and between the fourth and fifth comment on posts you set 2, 4 for the filter.
- If you need to insert an ad every fifth comment on posts you set %5 for the filter.
- In some WP themes hooks (that call Ad Inserter insertion functions) are called more than once. In such case you might get unwanted insertions. Simply set the filter to the number of the wanted call(s). Use debugging function Show positions on post or page to show available positions for automatic insertion with counters.
- If you need to insert block only on subpages but not on the first or main page then set Filter to 1, filter counter to Subpages and check Invert filter
Filter also works for paragraph counting. Leave Paragraph number(s) empty, set filter to Paragraphs and define comma separated list of paragraph numbers where the code should be inserted (
%N can also be used).
You can also leave Filter empty (means all insertions) and define maximum number of insertions (tab Insertion).
Filter counter defines the counter that should be used for counting. Default Auto counter selects the counter based on the context and should work in most cases. Other filter counters are:
- Auto – counter based on the context
- PHP function calls – counts
adinserter ()PHP function calls
- Content processing – counts
- Excerpt processing – counts
- Before post processing – counts
- After post processing – counts
- Widget drawing – counts drawing (insertion) of widget for each block
- Subpages – counts subpages – when the page is divided with the
- Posts – counts
- Paragraphs – counts post paragraphs according to paragraph counting settings
- Comments – counts post comments
Invert Filter inverts insertion – listed insertions are disabled.
With some themes blocks seem to be inserted more than what is seen on the post or page. Check Insert only in the loop setting above.
In addition to popup messages and page redirection you can replace ads that were blocked with some that may not be blocked. You can also hide or show some ads (or whatever is in the code block) when ad blocking is detected.
Ad Blocking detection needs to be enabled for ad replacement to work (tab ⚙ / tab Ad Blocking). You also can’t use No Wrapping style as wrapping div has to be used in order to mark code blocks which need to be replaced/shown/hidden.
This is the default setting for code block. When ad blocking is detected it does nothing.
When ad blocking is detected the code block will be replaced with replacement code block (ad). Replacing means that the replacement block is normally inserted but hidden (using CSS). When ad blocking is detected the original ad is hidden (regardless whether it was blocked or not) and the replacement ad is shown.
Choose replacement ads wisely. Do not name images with standard names (ad, ads, banner) or with ad dimensions (300×250). Use some neutral name that will not alert ad blockers.
The block is normally inserted but hidden (using CSS). When ad blocking is detected the ad (or any code) is shown.
The block is normally inserted and visible. When ad blocking is detected the ad (or any code) is hidden.
General tag is the text that is used for
[adinserter data='tag'] and
[adinserter data='smart-tag'] shortcodes when the post has no tags – useful for contextual ads.
It works only inside posts and static pages!