How do I exclude recent post from recent post php widget

I have this code, and I tried adding in post__not_in as suggested by another post I found on this website, and it didn't break anything but didn't work either. I also tried different examples.

Here's the php code I have

?php 
$args = array( 'posts_per_page' = '4', 'post__not_in' = array($currentID) );
$recent_posts = new WP_Query($args);
while( $recent_posts-have_posts() ) :  
    $recent_posts-the_post() ?
    li

        ?php if ( has_post_thumbnail() ) : ?
            ?php the_post_thumbnail( $size, $attr ); ?
        ?php endif ? 

    /li
?php endwhile; ?
?php wp_reset_postdata(); # reset post data so that other queries/loops work ? 

It doesn't get rid of the current post on the list

Topic recent-posts exclude get-posts php Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.