Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

wordpress loop over posts but exclude current post

$args = array(
    'numberposts' => 5,
    'offset' => 0,
    'category' => 7,
    'post__not_in' => array( $post->ID )
);
$myposts2 = get_posts($args);
Source by wordpress.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #wordpress #loop #posts #exclude #current #post
ADD COMMENT
Topic
Name
6+7 =