• s0206

    (@s0206)


    Hello All

    I have been trying to auto refresh the comments section on a new site I am developing. I came this excellent piece of code and it does the job brilliantly. The only thing is, it appears to display all comments from the entire blog rather the comments for the specific post.

    I can’t seem to work out what is wrong, here is the code:

    https://pastebin.com/jy30qmnW

    It’s taken from the wonderful blog: https://nikos-web-development.netai.net

    Can anyone help me work out what is wrong here?

    Thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    The database query ($request) is not restricting the search for comments with a particular post ID. You need to get the current post ID into the function somehow, then add something like AND comment_post_ID = '$current_postID' to the WHERE line.

    Hi s0206,

    where exactly do you use this code?
    It makes a difference if the code can access the global $post variable (which contains the curent post_id) or is used outside the Loop.

    If you can post the whole page where this code is used it could help resolve this issue

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘comments auto refresh’ is closed to new replies.