我想更改以下代码以重定向一些外部链接,而不是重定向到登录页面。我该怎么办?
<?php
function vbcr_simple_content_restriction() {
global $wp_query;
if( !is_user_logged_in() ) {
if( is_category() || is_archive() || is_single() || is_tax() || is_tag() || is_feed() || is_comment_feed() || is_attachment() || is_search() ) {
$option_redirect_to = get_option('redirect-to');
if(empty($option_redirect_to)) {
// retrieve WP login URL
$option_redirect_to = wp_login_url();
}
$status = "302";
wp_redirect( $option_redirect_to, $status ); exit;
}
}
ob_flush();
}
function content_restriction_output_buffer() {
// this is needed for the redirection
ob_start();
如您所见,它进入wp登录网址:
$option_redirect_to = get_option('redirect-to');
if(empty($option_redirect_to)) {
// retrieve WP login URL
$option_redirect_to = wp_login_url();
如何将其更改为以下链接:https://example.com/external?