I am writing a Wordpress plugin that adds an admin menu page. There is a form on the page. When the form is submitted, the plugin writes to the database. But then I came across a problem: whenever the user reloads the page, they ask him whether to send POSTDATA again. If the user clicks "Yes", the plugin writes to the database again.
After some searching, I found a solution, the "Post-Redirect-Get" template. Then, later, I found it difficult to implement this template in the Wordpress plugin.
The plugin itself cannot send HTTP 301/302, because there is some content already issued by the Wordpress core.
You can insert a meta tag in the HTML header (in order to issue a redirect). But according to the W3C, the meta redirect is out of date, so I think it's best not to use it.
Use JavaScript window.location . But what if JavaScript is disabled in the user's browser?
Is there any other way to redirect?
source share