'post_not_in' => array($post_id),
Here is your problem, and there are two of them:
- The parameter key is misspelt
- There’s a massive performance hit that can be easily avoided
Using the Correct Key
It should be post__not_in
not post_not_in
. This will restore the desired behaviour, but with a huge performance hit that gets heavier as the size of the posts table increases.
This is because you should always ask the database for what you want, never ask it for what you do not want. MySQL will respond to this by creating a brand new copy of the posts table that doesn’t have that post, then performing the query on the new table, then discarding it.
But there’s a simple alternative
Fixing the Performance
The solution is simple, ask for 5 posts instead of 4 and skip the post you don’t want. Excluding posts in PHP is almost instant in comparison.
For example:
$q = new \WP_Query( [ 'posts_per_page' => 5 ] );
$counter = 0;
$post_to_skip = 1;
if ( $q->have_posts() ) {
while ( $q->have_posts() {
$q->the_post();
if ( get_the_ID() === $post_to_skip ) {
continue; // skip
}
if ( ++$counter === 4 ) {
break; // only 4 posts
}
// ... display post
}
wp_reset_postdata();
}