WP_Query exclude post by ID
-
Hi there I was wondering if there’s anyway to exclude a post returned by a wp_query using the post’s ID.
See I have one section of the page (on left for eg) which shows one featured post (w/ excerpt + large image etc) then on the other side (on right for eg) of the page, there are more featured/popular posts (just showing a small image). By default the post on the left is the first post from the list of featured posts, and the same for the section on the right. So I don’t want two of the same posts showing up.
Is there any way in which I can use the_ID() from the “right query” in the “left query” as to exclude it from the returned posts. (e.g “WHERE post_id !=$featuredPost; …or something like that, in a wordpress query though)
- The topic ‘WP_Query exclude post by ID’ is closed to new replies.