我的代码如下所示。
$result = $wpdb->query($sql);
if ( $result ) {
wp_redirect( "http://www.example.com/contact-us");
exit();
}
我发现以下错误
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
我尝试了以下代码,但没有得到任何解决方案
$result = $wpdb->query($sql);
if ( $result ) {
ob_start();
wp_redirect( "http://www.example.com/contact-us");
ob_end_flush();
exit();
}