Hot answers tagged

2

If you need to skip the current post, you can make use of the offset parameter. The value passed will the amount of posts to skip, so in your case, you would do 'offset' => 1, to skip the latest post. Just a note on offset, when you add offset to any query, it breaks pagination. WP_Query internally uses offset to calculate pagination. If you need to ...


1

You need the WP_Query documentation. WP_Query is very powerful, and you can do a lot with it :) In your case, I don't think exclude is a valid parameter. What you're probably looking for is this: $query->set( 'post__not_in', array( 34 ) ); Here's the Post & Page Parameters section of the documentation, which covers this and the other parameters ...



Only top voted, non community-wiki answers of a minimum length are eligible