I am trying to get the two most recent post but however i want to exclude a specific post by its id[365]. Can anyone help me with it? here's my code.
$args = array( 'numberposts' => '2' , 'post__not_in' => array( '365' ) );
$recent_posts = wp_get_recent_posts( $args );
<?php foreach($recent_posts as $post):?>
<a href="<?php echo $post['guid']?>"><p><?php echo $post['post_title'];?></p></a>
<?php endforeach;?>
Just need to replace your code by below mentioned code, you will get your desired result :
<?php $my_args = array('post_type' => 'post' , 'numberposts' => '2' , 'exclude' => '365' );
$my_recent_posts = wp_get_recent_posts( $my_args );?>
<?php foreach($my_recent_posts as $my_post):?>
<a href="<?php echo $my_post['guid']?>"><p><?php echo $my_post['post_title'];?></p></a>
<?php endforeach;?>