0

I was going through the following code

'post__not_in' => array($post->ID) but I am unable to understand this.

What information does this supply $post->ID

1 Answer 1

2

The post ID.

It's not possible to say any more without more context. If I had to guess $post in this case is a WP_Post object that represents the current post and the author of the post wants to get some posts while excluding the current post. Just be aware that doing so this way is typically a bad idea.

2
  • 1
    I agree with @jacob-peattie, but to clarify, it's not just trying to eliminate the current post that's bad. It's using post__not_in that affects performance... as Mr Peattie's link further explains.
    – rudtek
    Aug 16, 2022 at 16:32
  • I am tryin to show related posts on single post page and going through this post wordpress.stackexchange.com/questions/30039/…
    – Amit Singh
    Aug 17, 2022 at 6:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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