Support » Plugins » Hacks » Submit button comment redirecting

  • Berg25


    Hello anyone reading this and sorry if I’m posting in the wrong section.

    I’m currently trying to build a website where the comments are all on 1 page.

    The problem I’m having is after you submit a comment, the page goes to the page where the comment was posted. Is there anyway after you click the submit button the comment is just posted and nothing else happens?

    I have been looking around but so far found nothing. If anyone can give me a hint or perhaps some help I would be very appreciative.

    Thank you.

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


    Use jQuery to capture the submit button click and send an AJAX request instead a regular POST. Prevent the POST by changing the form action attribute to “#”. Your server side AJAX handler could do the call to wp_new_comment() (after verifying it’s OK for the user to do so) and respond with a false on failure in which case your jQuery script could display a message, otherwise do nothing.



    I’m pretty new at wordpress but I will try out how to do that.

    Thanks alot! I now have a direction to look to :3

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Submit button comment redirecting’ is closed to new replies.