Post Content Condition

The Post content display condition provided by Advanced Ads Pro allows you to show ads based on specific keywords or phrases in the content.

This condition helps you to increase your ads’ relevancy which can result in higher click-through rates and revenue.

Furthermore, you can exclude certain ads or placements from pages with critical content, e.g., adult content, to avoid violating the policies of specific ad networks like Google AdSense.

Displaying ads based on keywords in the content using the Post content condition.
Show or hide ads depending on occurring words in the content

How to show ads based on specific content

Add the Post content display condition to an ad or a placement to show them based on keywords in the content.

The ad or placement that uses this condition can be placed within the content as well as outside of it, like in your sidebar or page footer.

Examples of contextual targeting

The Post content condition comes with several types of checks. You can find a few examples below. Let’s assume, the following is the content of our post:

Salmon is one of the most popular fish and, in countless ways, prepares a constant companion on the menus. Fresh white wines are usually the ideal accompaniment for fish dishes. But rosé wines and young red wines can also be an exciting alternative for the experimental palate.

Contains/does not contain

The option “contains“/“does not contain“ checks whether the text includes the defined keyword or not.

In our example, the ad should only show up if the text contains the term “wine”.

Example: Ads based on keywords a text contains
The ad should appear on pages that contain “wine”

The keyword “wines” appears several times in the sample text, and it contains the term “wine”. Therefore, an ad with this condition would appear on a page with that text.

Starts with/does not start with

The option “starts with“/“does not start with“ checks whether a text begins with a particular keyword or phrase or not.

Example: Ads based on words a text starts with
The ad should appear on pages that begin with “wine”

The sample text does not begin with “wine”, but with “Salmon”. Therefore, the ad would not appear on a page with this example text.

Ends with/does not end with

The option “ends“/“ends with“ checks whether the text ends with the defined keyword or phrase or not.

Example: Ads based on words a text ends with
The ad should appear on pages that end with “wine”

The text ends with “palate” and not “wine”. Therefore, as with the previous example, the ad would not appear.

As mentioned, Advanced Ads considers the exact input. The ad would not even appear if “palate” was defined.

The correct phrase, in this edge case, to let the ad show up would be “palate.”, including the punctuation.

Example: Ads based on words ending with a specific expression
This is how you would need to configure the condition to match the example text

Matches/does not match

The “match”/“don’t match” option checks whether the defined string is congruent with the post’s content.

Please note that, in contrast to the “contain” option, the plugin thus checks not only whether the expression is included but whether it is identical to the entire content.

Example: Ads based on matching keywords
The ad should appear on pages that contain the exact term “wine”

In our text example, this would mean that Advanced Ads does not show the ad since “wine” is only a part of the text.

Matches Regex/does not match regex

Choosing the “matches regex” or “does not match regex” option checks whether the text matches a defined regular expression.

Dealing with regular expressions allows you to use them in various ways. One use case for them could be advanced negative keyword targeting, e.g., not displaying Google AdSense ads on pages with content about tobacco products to comply with the Google AdSense policies.

The regex option is often more straightforward than the “Contain” option when checking several keywords at once. With the “Contain” option, you would have to add a new condition for each keyword. With regular expressions, on the other hand, you can capture and target entire keyword families at once. 

The setting on the following example ensures that an ad does not appear in posts that contain any of the keywords included in the regular expression.

 /cigarettes|cigars|tobacco|pipes|rolling papers|chewing tobacco|e-cigarettes/
Example for negative keyword targeting

You can test and adjust your regular expressions on sites like regex101.

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

* indicates required


The condition considers only the text in the content area of the website.

It may also take dynamically added content into account. For example, if you use a plugin that automatically adds an author box at the end of posts, you might mess up the “ends with” check. The same can happen with automatically added “related articles” lists.

You will most likely not align your keyword targeting with the end phrase of your text. However, if you’re facing this issue, you can often fix it by experimenting with the priority values of the content injection filter in Advanced Ads > Settings > General.

General Advanced Ads settings
Advanced Ads settings

Make it better

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