简体   繁体   English

jQuery未在wordpress wp-admin中定义

[英]jQuery not define in the wordpress wp-admin

I am using 4.1 verion of wordpress, I have tried wordpress version 3.8.1 etc, in wp-admin it is throwing jquery is not defined error. 我正在使用4.1版本的wordpress,我尝试了wordpress版本3.8.1等,在wp-admin中它抛出jquery未定义错误。 I have tried uninstalling all the plugins, deleting all the wp-admin and wp-includes files. 我尝试卸载所有插件,删除所有wp-admin和wp-includes文件。

I have tried the following codes in wp-config, 我在wp-config中尝试了以下代码,

   define('CONCATENATE_SCRIPTS', false);
   define('SCRIPT_DEBUG', true);

none of them are working, any help, Thanks 他们都没有工作,没有任何帮助,谢谢

I opened up the devtools console on your site, and found that when it tries to include jQuery from http://www.coasterline.com/wp-includes/js/jquery/jquery.js/?ver=1.11.0 it's actually returning your homepage, not a JS file. 我打开了您网站上的devtools控制台,发现当它尝试从http://www.coasterline.com/wp-includes/js/jquery/jquery.js/?ver=1.11.0包含jQuery时,它实际上是返回您的首页,而不是JS文件。 I've seen this before when the .htaccess file isn't set up right. .htaccess文件设置不正确之前,我已经看到了这一点。

In WordPress, the .htaccess file redirects all requests to anything under your main WP directory to the index.php file, but there's supposed to be an exception for resource files like images, JS, and CSS. 在WordPress的.htaccess文件重定向到任何东西的所有请求你的主目录WP到下index.php文件,但应该是像图片,JS和CSS资源文件例外。 I'm guessing your .htaccess file is corrupt and is redirecting EVERYTHING to index.php , even JS files. 我猜想您的.htaccess文件已损坏,并将所有内容都重定向到index.php ,甚至是JS文件。

This is what .htaccess is supposed to look like : .htaccess 应该是这样的

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

These 2 lines exclude files ( !-f ) and directories ( !-d ) from the rewrite condition: 这两行从重写条件中排除文件( !-f )和目录( !-d ):

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

Make sure those are intact. 确保这些完好无损。

I see this problem a website, in fact it was due to a hacked website : 我在网站上看到此问题,实际上是由于网站被黑客入侵:

  1. download a fresh WP install ZIP, same version as yours 下载新的WP安装ZIP,与您的版本相同
  2. use FTP to delete wp-include and wp-admin from your website 使用FTP从您的网站删除wp-include和wp-admin
  3. unzip the WP install zip, and FTP upload clean wp-include and wp-admin 解压缩WP安装zip,FTP上传干净的wp-include和wp-admin
  4. Go to your WP admin, and it must be available now 转到您的WP管理员,它现在必须可用

The wp-include and wp-admin folders must not be touched, they are a part of the WP basic install. 请勿触摸wp-include和wp-admin文件夹,它们是WP基本安装的一部分。 That's why they can be safely removed and replaced by clean ones without risk. 这就是为什么可以安全地将它们卸下并用干净的无风险的替代。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM