让开发人员为 wordpress 构建主题。该站点是 beonpointe.com - 已尝试使其生效并且 url 只是重定向到/index1.html - 主机没有域转发,HTACCESS 中也没有任何域转发。
我在主题的 functions.php 中找到了一个片段,但取消注释以查看它是否有效,但仍然无效。请问有人能帮忙吗?!
代码片段是:
<?php
define('TEMPLATE_DOMAIN', 'beonpointe');
define('BOP_IS_LIVE', 'true');
function only_admin_access(){
if( BOP_IS_LIVE == 'true' ):
if( !is_user_logged_in() ):
wp_redirect( site_url('') );
endif;
endif;
}
add_action('wp_top_head', 'only_admin_access');
?>
非常感谢。提前谢谢你。
最佳答案
<?php
define('TEMPLATE_DOMAIN', 'beonpointe');
define('BOP_IS_LIVE', 'true');
function only_admin_access(){
if( BOP_IS_LIVE == 'true' ):
if( !is_user_logged_in() ):
wp_redirect( home_url() );
exit;
endif;
endif;
}
add_action('wp_top_head', 'only_admin_access');
?>
关于php - Wordpress 重定向循环错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27558682/