Title: Exclude current post
Last modified: August 31, 2021

---

# Exclude current post

 *  [scampik84](https://wordpress.org/support/users/scampik84/)
 * (@scampik84)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/exclude-current-post-21/)
 * Hi,
 * is there possibility to exclude current post please? I cant find that ..
 * Thank you

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

 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/exclude-current-post-21/#post-14843763)
 * You can’t do this directly right now within the settings.
 * You could write a function to filter `tptn_exclude_post_ids`
    [https://github.com/WebberZone/top-10/blob/master/includes/class-top-ten-query.php#L251](https://github.com/WebberZone/top-10/blob/master/includes/class-top-ten-query.php#L251)
 *  [edzis632](https://wordpress.org/support/users/edzis632/)
 * (@edzis632)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/exclude-current-post-21/#post-14985198)
 * Thanks Ajay for the tip!
 * I pushed current post ID into $exlude_post_ids array and it worked.
    Added `array_push(
   $exclude_post_ids, strval(get_the_ID()));` after `$exclude_post_ids = apply_filters('
   tptn_exclude_post_ids', $exclude_post_ids, $args );`
    -  This reply was modified 4 years, 7 months ago by [edzis632](https://wordpress.org/support/users/edzis632/).
    -  This reply was modified 4 years, 7 months ago by [edzis632](https://wordpress.org/support/users/edzis632/).
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/exclude-current-post-21/#post-14999591)
 * [@edzis632](https://wordpress.org/support/users/edzis632/)
 * Did you edit the code? If so, you might have an issue with the next update and
   you’ll have to add it again.
 * You can try this code in your functions.php or a mu-plugins
 *     ```
       function tptn_exclude_current_post( $exclude_post_ids ) {
   
       	array_push( $exclude_post_ids, absint( get_the_ID() ) );
       	$exclude_post_ids = array_filter( $exclude_post_ids );
   
       	return $exclude_post_ids;
   
       }
       add_filter( 'tptn_exclude_post_ids', 'tptn_exclude_current_post' );
       ```
   

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

The topic ‘Exclude current post’ is closed to new replies.

 * ![](https://ps.w.org/top-10/assets/icon-256x256.png?rev=2986432)
 * [WebberZone Top 10 — Popular Posts](https://wordpress.org/plugins/top-10/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/top-10/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/top-10/)
 * [Active Topics](https://wordpress.org/support/plugin/top-10/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/top-10/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/top-10/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [Ajay](https://wordpress.org/support/users/ajay/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/exclude-current-post-21/#post-14999591)
 * Status: not resolved