I have coded a form into a WordPress theme. Everything is working fine, except the form data will re-submit when a page is refreshed. Obviously, I need to make some change in URL in order to fix it. I am trying to add something like ?submission=success in the URL, which I will use as a condition to display a success message or load form. How can I add this to URL?


try this :

// constructing URL
$url = add_query_arg(["submission" => "success"]);

// redirection
| improve this answer | |
  • URL is not changing.. it still shows http://localhost/.../staff-customers-add/. Does this have to do with format of the permalinks? Or do I have to change something in settings to enable such modifications in URL? – user1543784 Jun 8 '17 at 12:15
  • SOLVED! Looks like wp_redirect() needs to be above the header. – user1543784 Jun 8 '17 at 14:17

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.