Testers needed for AdRotates Post Injection

logo-512x512If you use Post Injection in AdRotate Pro or AdRotate Free and then specifically a setting using the “after …” option then consider helping to test the new paragraph detection in AdRotate.


This new method is aimed at fixing the long standing issue where a random advert gets added to the last paragraph of your content because of how WordPress their [no-highlight]wpautop[/no-highlight] filter works. The filter smartly reformats your post to add paragraphs and whatnot, except it also adds a empty paragraph at the end, causing AdRotate to do something weird.

I have created a new paragraph detector using [no-highlight]preg_match_all()[/no-highlight] and this regex: [raw]/(?:.*?)]*>(?:.*?)<\/p>(?:<\/[a-z]*?>)*/is[/raw]
The current system uses a simple [php]explode(‘

‘, $post_content);[/php] but that doesn’t smartly detect paragraphs.

The idea of the regex is to split [php]$post_content[/php] by the paragraph tag while not stripping out tags between paragraphs. But also if you wrap the paragraph in something else such as [html]

[/html] or [html][/html] that also may not be lost.

It works for me on my test site and on meandmymac.net but to be sure it needs testing on a bunch more sites. Also if you know something about regexes (I don’t) and think this is a dumb regex or that it needs improving. Let me know.

So if you have some time, and are willing to give this a go get in touch via the contact page or leave a comment below. You don’t need to know any code or programming to help. Simply the ability to verify that your page formatting and layout aren’t ruined or missing parts after using this beta is enough. Thanks!