The Post Content placement allows you to automatically inject ads into the content of your posts and pages based on paragraphs or other elements in it.

Since ads within the content are the best performing ones, this placement can have a large impact on the ad performance, if used correctly.

Injecting an ad into the content

In order to inject an existing ad or ad group into the content of your posts, you need to create at least one Post Content placement. Go to Advanced Ads > Placements and create a new placement with the type represented by the following image:

ad placement within the content

The placement you will now see in your placement list should look similar to the one on the next image:

settings for content ads

In this example, the placement injects our Medium Rectangle ad after the 2nd paragraph on each post.

Content placement options

These are the options coming with the content placement.


The name is created during the creating of the placement and has no other meaning than to help you identify it.


The item of the post content placement is the ad or ad group you want to inject into the content.

Before or after

You can select whether the ad or ad groups should be injected before or after a specific element. It depends on the specifics of your site and the elements in the content, which option is better, but you can select a different one for each post content placement that you create.


The index is the number of the element in the content. If you want to inject an ad after the 3rd paragraph then select after and 3rd.


The element is the HTML tag in the content before or after which the ad is injected. Posts always have paragraphs, but can also have headlines and other elements.

It is important to notice that most elements only count on the top level. E.g., paragraphs in another box or headlines in a table, are not considered for ad injection.

Count from bottom

You can also choose to count the index from the bottom. E.g., this would allow you to inject an ad before the last paragraph.

Advanced Options

These are options added by Advanced Ads Pro to especially extend the functionalities of the Post Content placement.

Inject ad after more tags

With Advanced Ads Pro you can also inject ads based on

  • paragraphs without images
  • containers (<div>)
  • images (<img>)
  • tables (<table>)
  • list items (<li>)
  • quotes (<blockquote>)
  • iframes (<iframe>)
  • any headline (<h2><h3>, or <h4>)
  • any element – any element with visible text in it

Let us know if you are missing more.

Repeat the position

Repeat the ad. E.g., if you set it to display after the second paragraph, checking this option would result in the ad to show up automatically after the fourth, sixth, eighth, etc. paragraph as well.

Note: not every ad network might support this. So far, we learned that doesn’t. AdSense works.

Minimum Content Length

Set a minimum length of the content before an ad is injected into it.

Words between ads

This option lets you define a minimum amount of words in a text section that is necessary before an ad will be injected. The option “Words between ads” will not inject an ad when the number of words after the last injected ad is less than the defined value. This includes paragraphs, headlines, and other text elements.

Prevent ad injection into the content

Pro adds a setting to the Ad Options meta box on the post and page edit pages to disable all automatic content injections for that specific page in the frontend.

General Settings

Change the order of injected elements

By default, Advanced Ads tries to inject ads to the post content as late as possible. However, this might not always be your attention. To change the priority of the injection, use the following option in Advanced Ads > Settings > General.

content injection priority option

Tip: Most injections have a priority between 1 and 20, so when trying to find the right value, start with 10 or 20.

Unlimited ad injection

Some plugins and themes trigger ad injections where it shouldn’t happen. Therefore, Advanced Ads ignores injected placements on non-singular pages and outside the loop. However, this can cause problems with some themes. Set this option to -1 in order to enable unlimited ad injection at your own risk, set it to 0 to keep it disabled or choose a positive number to enable the injection only in the first x posts on your archive pages.

You find this setting in Advanced Ads > Settings > General.

Unlimited ad injection setting

Custom solutions

Here are some custom solutions for issues with the content injection placements.

Prevent injection into specific elements

You can prevent automatic ad injection into specific elements by adding the .advads-stop-injectionclass.

You can add your own elements by with the custom code explained here.

Ad injection without the_content()

If your theme can not use the the_content function, but get_the_content() or a similar approach, you can apply the ad injection manually using a line like this in your theme:

echo Advanced_Ads::get_instance()->inject_content( get_the_content() );

Ad injection with a different filter

You can use ad injection on content that uses a different filter, too, when Advanced Ads Pro is enabled. Just set the ADVANCED_ADS_PRO_CUSTOM_CONTENT_FILTER constant in your wp-config.php like in the example below. Replace YOUR_FILTER with your filter string.


Injection without <p> tags

If your theme does not use <p> tags to separate paragraphs, but for example <br/>, then you can insert the following code into your theme’s functions.php to add that option to the content injection placement.

// this adds a <br/> option to the content injection placement 
add_filter( 'advanced-ads-tags-for-injection', 'advads_content_injection_br' );
function advads_content_injection_br( $tags ){
        $tags['br'] = sprintf( __( 'break (%s)', 'advanced-ads' ), '<br>' );
        return $tags;

// this allows to inject ads between self closing HTML tags
add_filter( 'advanced-ads-placement-content-injection-options', 'advads_content_injection_br_options', 10, 2 );
function advads_content_injection_br_options( $options, $tag ){
    if( 'br' === $tag ){
        $options['allowEmpty'] = true;
    return $options;


The content injection can break for various reasons. Mostly, because of a broken ad code or when the paragraphs can not be counted due to a broken tag. Such issues will be captured in the error log or displayed below the ad when you have WP_DEBUG enabled in your wp-config.php.