Title: Exclude Current post in loop
Last modified: April 24, 2017

---

# Exclude Current post in loop

 *  Resolved [raven747](https://wordpress.org/support/users/raven747/)
 * (@raven747)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/exclude-current-post-in-loop/)
 * Hello,
 * Thanks for all the help with setup. Working well now. The issue I am now having
   is I am trying to ensure the current story is not included in the more articles
   loop. Just looks cleaner if it excludes it.
 * Thanks in advance for all help!

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

 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/exclude-current-post-in-loop/#post-9062715)
 * Hi [@raven747](https://wordpress.org/support/users/raven747/),
    No problem.
 * You can do this by passing the current post ID to post__not_in param.
 *     ```
       // Outside loop
       global $post;
       $exclude  = $post->ID;
   
       echo do_shortcode('[ajax_load_more post__not_in="'.$exclude.'"]');
       ```
   
 *  Thread Starter [raven747](https://wordpress.org/support/users/raven747/)
 * (@raven747)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/exclude-current-post-in-loop/#post-9063025)
 * Wow thanks! Is it possible to do this not in direct PHP and just with shortcode,
   or does this need to be done as a PHP
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/exclude-current-post-in-loop/#post-9063034)
 * No problem!
    Unfortunately it must be done in php.
 *  Thread Starter [raven747](https://wordpress.org/support/users/raven747/)
 * (@raven747)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/exclude-current-post-in-loop/#post-9065578)
 * Thanks for the help!

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

The topic ‘Exclude Current post in loop’ is closed to new replies.

 * ![](https://ps.w.org/ajax-load-more/assets/icon-256x256.png?rev=2944639)
 * [Ajax Load More – Infinite Scroll, Load More, & Lazy Load](https://wordpress.org/plugins/ajax-load-more/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-load-more/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-load-more/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-load-more/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-load-more/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-load-more/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [raven747](https://wordpress.org/support/users/raven747/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/exclude-current-post-in-loop/#post-9065578)
 * Status: resolved