Avoid Duplicate Posts in Multiple Loops
Code:
Instructions:
Let’s start by creating a simple PHP array, and put all post IDs from the first loop in it.
Now, the second loop: we use the PHP function in_array() to check if a post ID is contained in the $ids array. If the ID isn’t contained in the array, we can display the post because it wasn’t displayed in the first loop.