wp_redirect() is not working
-
My code is like below.
$result = $wpdb->query($sql); if ( $result ) { wp_redirect( "https://www.example.com/contact-us"); exit(); }
I am getting below error
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wordpressplugin/wp-admin/includes/misc.php:1281) in /var/www/html/wordpressplugin/wp-includes/pluggable.php on line 1296
I tried with below code but I didn’t get any solution
$result = $wpdb->query($sql); if ( $result ) { ob_start(); wp_redirect( "https://www.example.com/contact-us"); ob_end_flush(); exit(); }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘wp_redirect() is not working’ is closed to new replies.