Exclude Current Post from Recent Posts Loop

Share Now

Share on facebook
Share on pinterest
Share on twitter
Share on linkedin
Share on email

*** post__not_in' => array( $post->ID )

$args = array(
    'numberposts' => 5,
    'offset' => 0,
    'category' => 7,
    'post__not_in' => array( $post->ID )
);
$myposts2 = get_posts($args);
Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert