Basically, on my site I have content submitted via a search bar. I'm using a content-none template to detect if the user is signed in - and if so it submits a post programmatically (if the post doesn't exist)

Now, after this is done I'd like the page to refresh after 3 seconds, and since it will pick up the previous search term, it will go to the submitted post automatically.

Is there a PHP or Wordpress method of doing this? Or will I need to insert JavaScript into the template page? (or in theory - possibly a way of forwarding to the $post_id? though I don't know how to grab it via the search term or with the info from wp_insert_post... )

FYI I cannot get header('refresh: 3;'); to work

  • Have you tried wp_redirect()? – user40422 Apr 15 '15 at 13:23

Found a method!


  • This is super annoying for your users, especially for those with assistive software. – fuxia Apr 15 '15 at 13:46
  • yup - very bad UI practice. Consider the use of ajax to refresh your page content. – jjarolim Apr 15 '15 at 14:20

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.