我有一个WordPress网站,必须登录才能直接访问。该网站提供视频帖子。因此,用户需要登录才能观看视频。此外,我还为每个视频提供了一个iframe链接。用户只有登录WordPress,然后刷新包含iframe的页面才能使用iframe来播放视频。
我的问题是:如果不使用iframe访问视频,有没有办法绕过登录页面?请注意,使用的所有iframe链接都指向我组织内的另一个已知网站。
以下是iframe链接示例:
<iframe width="400" height="250" src="https://example.com/?action=getembedcode&v=1851254" frameborder="0" allowfullscreen></iframe>
我用来强制登录的插件是“强制登录”。
SO网友:Kevin Vess
您可以绕过Force Login 根据任何条件,添加v_forcelogin_bypass 过滤主题的功能。php文件。您也可以使用WordPressConditional Tags.
例如:
/**
* Bypass Force Login to allow for exceptions.
*
* @param bool $bypass Whether to disable Force Login. Default false.
* @return bool
*/
function my_forcelogin_bypass( $bypass ) {
if ( is_single() ) {
$bypass = true;
}
return $bypass;
}
add_filter( \'v_forcelogin_bypass\', \'my_forcelogin_bypass\' );
我建议您尝试以下绕过方法:
Method 3 – Page URL based on Query String Parameter(s) and/or Value(s)
例如:
// Allow iframe videos
if ( $_GET[\'action\'] == \'getembedcode\' && isset( $_GET[\'v\'] ) ) {
$bypass = true;
}