0

I know how to remove all of the sticky posts from a loop using the following argument

'post__not_in'  => get_option( 'sticky_posts' ),

But I am stuck in a problem. I want the loop to load all of the sticky posts except the latest one. That means only the latest sticky post won't render in the loop but the other old sticky posts will load as usual.

I want to do that coz I will make another query to render the latest sticky post on top of the main loop in a separate 'div'

Thanks in advance

1

So if you're getting the sticky-post you want removed anyways

I want to do that coz I will make another query to render the latest sticky post on top of the main loop in a separate 'div'

Just make a variable, $excludeSticky, with it's ID, and add an 'post__not_in' => array($excludeSticky), argument in your query.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.