iframe中的WordPress登录 [英] WordPress Login inside an iframe

查看:126
本文介绍了iframe中的WordPress登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从wordpress网站构建移动应用程序,并且已经通过iframe加载了该网站.到目前为止,一切工作正常,但是当我进入登录页面时出现此错误:

I'm trying to build a mobile app out of a wordpress site, and I've got the site loading via an iframe. Everything is working nicely so far, but I'm getting this error when I go to the login page:

拒绝显示' http://example.com/wp-login.php",因为它将"X-Frame-Options"设置为"SAMEORIGIN"."

"Refused to display 'http://example.com/wp-login.php' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'."

我做了一些谷歌搜索,发现另一个人在这里遇到类似的问题-

I've done some Googling and I found another person who had a similar problem here - Embed wordpress admin inside an iframe. The solution was to use

remove_action( 'login_init', 'send_frame_options_header', 10, 0 );
remove_action( 'admin_init', 'send_frame_options_header', 10, 0 );

但是,老实说,我不知道将代码放在何处.还有一些Google搜索使我指向"./wp-includes/default-filters.php"文件,但是每次WP更新都会覆盖吗?我可以将该代码放在哪里,以免被覆盖,并且可以在iframe中加载WP登录信息?

But I've honestly got no clue where to put that code. Some more Googling pointed me towards the "./wp-includes/default-filters.php" file, but wouldn't that get overwritten with each WP update? Where can I put that code so it doesn't get overwritten and I can load my WP login inside an iframe?

推荐答案

我知道了:)感谢这篇文章-

I figured it out :) Thanks to this post - Can't access WordPress Dashboard in an iframe. The solution was to put

remove_action( 'login_init', 'send_frame_options_header' );
remove_action( 'admin_init', 'send_frame_options_header' );

在functions.php文件中的

.像魅力一样工作.

in the functions.php file. Worked like a charm.

这篇关于iframe中的WordPress登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆