# Beaver Builder Post Modules: Leave Out the Current Post

> Removes the post being viewed from Beaver Builder Posts, Post Slider and Post Carousel modules, so "latest posts" blocks on articles never repeat the article itself.

- Type: PHP
- Runs: Frontend only
- Category: [Page Builders & Themes](https://wpide.com/library/category/page-builders/)
- Tags: beaver-builder, posts, query
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/beaver-builder-loop-exclude-current/

## Code

```php
add_filter( 'fl_builder_loop_query_args', function ( $args ) {
    if ( ! is_singular() ) {
        return $args;
    }

    $exclude   = isset( $args['post__not_in'] ) ? (array) $args['post__not_in'] : array();
    $exclude[] = get_queried_object_id();

    $args['post__not_in'] = array_values( array_filter( array_map( 'absint', $exclude ) ) );

    return $args;
} );
```

## Notes

Applies to every Beaver Builder post module on single posts and pages.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Beaver Builder Post Modules: Leave Out the Current Post" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
