在我的自定义wordpress插件中使用exit

时间:2017-06-08 08:58:07

标签: php wordpress header

对于其中一个用户,在点击插件的保存设置按钮时,用户只会被重定向,并显示“您的许可证已激活”消息,并带有白色屏幕

我知道这个问题之前已经被回答了很多次。我尝试了很多解决方案,比如删除空格(如果有的话),在函数中添加ob_start()但是它还没有解决

Message getting displayed on white screen

我的代码中的第360行

<p><?php _e('Your license has been activated!', $lang_slug);?></p>

Pluggable.php代码

function wp_redirect($location, $status = 302) {
global $is_IIS;

/**
 * Filters the redirect location.
 *
 * @since 2.1.0
 *
 * @param string $location The path to redirect to.
 * @param int    $status   Status code to use.
 */
$location = apply_filters( 'wp_redirect', $location, $status );

/**
 * Filters the redirect status code.
 *
 * @since 2.3.0
 *
 * @param int    $status   Status code to use.
 * @param string $location The path to redirect to.
 */
$status = apply_filters( 'wp_redirect_status', $status, $location );

if ( ! $location )
    return false;

$location = wp_sanitize_redirect($location);

if ( !$is_IIS && PHP_SAPI != 'cgi-fcgi' )
    status_header($status); // This causes problems on IIS and some FastCGI setups

header("Location: $location", true, $status); //line no: 1195

return true;
}
endif;

自定义插件中的PHP函数

public static function notice_valid_license() {
?>
<div class="updated">
    <p><?php _e('Your license has been activated!',$lang_slug);?></p>
</div>
<?php
}

我应该在功能结束前添加退出; 吗?

请有人建议我吗?提前谢谢!

0 个答案:

没有答案