Try this:
'post__not_in' => array( get_the_ID() ),
what is the result if you either echo $post->ID or get_the_ID() before your code?
if you don’t get the ID of your single post, possibly try to add global $post before your code
Using get_queried_object()->ID could also work if you are on a page where the post object has been set.
Thread Starter
Pete
(@perthmetro)
@phpcentre… no joy, but thanks.
@alchymyth… thanks, i’m not sure I’m putting the global $post in the correct place? Could you tell me where it goes?
@tormorten… thanks, again would you be able to apply that for me in my snippet?
Thanks all.
putting the global $post in the correct place?
try before this line:
$args = array (
it is possible that the post ID could have been currupted by whatever code is between the ‘normal’ loop and your sidebar…
did you try to print the post ID at the start of your code to see if it is the right one?