Title: Exclude old posts
Last modified: January 6, 2018

---

# Exclude old posts

 *  Resolved [perfectly4med](https://wordpress.org/support/users/perfectly4med/)
 * (@perfectly4med)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/exclude-old-posts-2/)
 * Hi – just come across this plugin 🙂
 * Is there a way to exclude posts prior to the installation date? I previously 
   used content template to do the same thing, and don’t need previous posts to 
   have the ads added a second time.
 * Thanks!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fexclude-old-posts-2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/exclude-old-posts-2/#post-9839426)
 * Try this code (enable PHP processing – top right button):
 *     ```
       <?php 
       $ads_since_date = '2018-01-06';
       if (get_the_date ('Y-m-d') < $ads_since_date) :?>
   
       AD CODE
   
       <?php endif; ?>
       ```
   
 * Set $ads_since_date to a date from when the ads should be inserted.
 * Of course, this code will work only inside posts and static pages.
 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/exclude-old-posts-2/#post-9842081)
 * Everything ok?
 *  Thread Starter [perfectly4med](https://wordpress.org/support/users/perfectly4med/)
 * (@perfectly4med)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/exclude-old-posts-2/#post-9847745)
 * Hi Igor
 * Thanks for the code! I’ve not had a chance to implement it before now.
 * It’s not working though – the ads are appearing irrespective of post date being
   before or after the $ads_since_date string (which I have kept the same). I’ve
   also had increased ‘webpage encountered a problem and reloaded errors’ since 
   I implemented the code. I’ve turned it off for now.
 * I have automatic insertion set to ‘after content’, and ticked Posts, with no 
   modifier.
 *  Thread Starter [perfectly4med](https://wordpress.org/support/users/perfectly4med/)
 * (@perfectly4med)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/exclude-old-posts-2/#post-9847761)
 * My bad – didn’t follow the instruction to enable php processing.
 * After that it worked, with a small adjustment – get_the_date **>** $ads_since_date
 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/exclude-old-posts-2/#post-9848210)
 * Great!
 * Of course, ads need to be excluded for old posts.
 * I would appreciate if you could write a short review:
    [https://wordpress.org/support/plugin/ad-inserter/reviews/](https://wordpress.org/support/plugin/ad-inserter/reviews/)
 * Thank you,
    Igor

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Exclude old posts’ is closed to new replies.

 * ![](https://ps.w.org/ad-inserter/assets/icon-256x256.jpg?rev=1502039)
 * [Ad Inserter - Ad Manager & AdSense Ads](https://wordpress.org/plugins/ad-inserter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ad-inserter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ad-inserter/)
 * [Active Topics](https://wordpress.org/support/plugin/ad-inserter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ad-inserter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ad-inserter/reviews/)

## Tags

 * [black list](https://wordpress.org/support/topic-tag/black-list/)
 * [exclude](https://wordpress.org/support/topic-tag/exclude/)
 * [old posts](https://wordpress.org/support/topic-tag/old-posts/)

 * 5 replies
 * 2 participants
 * Last reply from: [Spacetime](https://wordpress.org/support/users/spacetime/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/exclude-old-posts-2/#post-9848210)
 * Status: resolved