wordpress exclude current post from loop

Solutions on MaxInterview for wordpress exclude current post from loop by the best coders in the world

showing results for - "wordpress exclude current post from loop"
Leina
29 Feb 2020
1$args = array(
2    'numberposts' => 5,
3    'offset' => 0,
4    'category' => 7,
5    'post__not_in' => array( $post->ID )
6);
7$myposts2 = get_posts($args);