前端上传时WP注销 [英] WP logout when upload on front

查看:115
本文介绍了前端上传时WP注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的主题有一个提交帖子页面,我配置了供所有人上传的用户功能.

My theme have a submit post page and I configure user capabilities for everyone to upload.

但是没有人可以上传.当我单击添加媒体"按钮并选择要上传的任何文件时,我当前的帐户将自动注销.

But no one can able to upload. And when i clicked "add media" button and select any file for upload, my current account is logging out automatically.

用户尝试上传后,该位置的访问者会落在哪里.你怎么认为?为什么要注销?

Where at, after user try upload, Visitors to the position falls. What do you think? Why logout?

推荐答案

为什么WordPress继续注销?

WordPress在浏览器中设置一个cookie来验证登录会话.此cookie是为存储在设置"部分中的WordPress URL设置的.

WordPress sets a cookie in your browser to authenticate a login session. This cookie is set for the WordPress URL stored in your settings section.

如果您从与WordPress设置中的URL不匹配的URL访问,则WordPress将无法对您的会话进行身份验证.

If you are accessing from a URL that does not match the one in your WordPress settings, then WordPress will not be able to authenticate your session.

解决登录问题

此登录问题的一个简单解决方案是确保WordPress设置中的站点地址"和"WordPress地址"字段中的URL相同.

A simple fix for this login issue is to make sure that you have the same URL in your Site Address and WordPress Address fields in your WordPress settings.

这意味着您需要在两个字段中选择www或非www URL.

This means that you need to choose either www or a non-www URL in the both fields.

登录到WordPress仪表板,然后转到设置"»常规".

Login to your WordPress dashboard and go to Settings » General.

如果您无法访问管理区域,则可以通过编辑wp-config.php文件来更新这些字段.

If you can’t access the admin area, then you can update these fields by editing the wp-config.php file.

使用FTP客户端连接到您的网站,然后在您网站的根目录中找到wp-config.php文件.您需要将此文件下载到桌面,然后在文本编辑器(如记事本)中打开它.将此代码添加到该行的上方.就这样,停止编辑!祝您博客愉快.

Connect to your website using an FTP client, and locate the wp-config.php file in your site’s root directory. You need to download this file to your Desktop and open it in a text editor like Notepad. Add this code just above the line That’s all, stop editing! Happy blogging.

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

如果您希望在网址中使用www,请改用此代码

If you prefer to use www in URL, then use this code instead

define('WP_HOME','http://www.example.com');
define('WP_SITEURL','http://www.example.com');

完整参考书

这篇关于前端上传时WP注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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