0

When user click the button, php code is executed. After that, the page is refresh. Here is my code.

<?php
}
//If click on button 
if (isset($_POST['deliver_confirmation']))
                    {
                       //Update payment meta of deliver_status
                       $meta['deliver_status']= 'Đã giao';
                       edd_update_payment_meta( $payment->ID, '_edd_payment_meta', $meta);
                       //REFRESH CURRENT PAGE CODE HERE
                       //echo '<meta http-equiv="refresh" content="5" />';//DOES NOT WORK
                    }


?>

Please tell me how can I refresh, or redirect to current page.

John
  • 3,888
  • 11
  • 46
  • 84
  • Possible duplicate of [Redirect the WordPress plugin after submitting button is clicked](http://stackoverflow.com/questions/27544911/redirect-the-wordpress-plugin-after-submitting-button-is-clicked) – John Feb 24 '16 at 02:04

2 Answers2

0

Try this:

header("Refresh:0"); // To Refresh

or

header('Location: http://www.test.com/'); // To Redirect
Gaurav Dave
  • 6,838
  • 9
  • 25
  • 39
  • I got this warning and the page is not refresh. Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wp-includes\class.wp-styles.php:172) in C:\xampp\htdocs\wp-content\plugins\easy-digital-downloads\templates\shortcode-receipt.php on line 290 – John Feb 23 '16 at 11:32
  • Look here: http://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php – Gaurav Dave Feb 23 '16 at 11:37
0

Try this Line:

echo '<script>parent.window.location.reload(true);</script>';
Shady Alset
  • 5,548
  • 4
  • 21
  • 34