wordpress添加媒体_如何修复添加媒体按钮在WordPress中不起作用

wordpress添加媒体

Recently one of our users reported that the ‘Add Media’ button on their WordPress site has suddenly stopped working. This problem does not display any error or warning which leaves users clueless about why their ‘Add Media’ button is not working. In this article, we will show you how to easily fix the ‘Add Media’ button not working issue in WordPress.

最近,我们的一位用户报告说,他们的WordPress网站上的“添加媒体”按钮突然停止工作。 此问题不会显示任何错误或警告,不会使用户不清楚他们的“添加媒体”按钮为何不起作用。 在本文中,我们将向您展示如何轻松解决WordPress中“添加媒体”按钮不起作用的问题。

Fixing add media button not working in WordPress
是什么导致WordPress的“添加媒体”按钮停止工作? (What causes the WordPress ‘Add Media’ Button to Stop Working?)

This problem is commonly caused by conflicting scripts or stylesheets loaded by WordPress plugins or themes installed on your site. The default behavior of WordPress is to load all required scripts and stylesheets by combining the requests.

此问题通常是由网站上安装的WordPress插件或主题加载的脚本或样式表冲突引起的。 WordPress的默认行为是通过组合请求来加载所有必需的脚本和样式表。

This is usually done in the WordPress admin area to improve performance and speed.

这通常是在WordPress管理区域完成的,以提高性能和速度

The WordPress post editor uses JavaScript for all buttons on the screen including the add media button. A conflict can stop JavaScript from working which will disable the ‘Add Media’ button.

WordPress帖子编辑器对屏幕上的所有按钮(包括添加媒体按钮)使用JavaScript。 冲突可能会导致JavaScript无法正常运行,这将禁用“添加媒体”按钮。

Add media button stopped working in WordPress

That being said, let’s take a look at how to troubleshoot and fix the ‘Add Media’ button not working in WordPress.

话虽如此,让我们看一下如何解决和修复“添加媒体”按钮在WordPress中不起作用的问题。

修复WordPress中的添加媒体按钮不起作用的问题 (Fixing Add Media Button Not Working Issue in WordPress)

The quick fix is to add the following code to your wp-config.php file. You can do this by editing wp-config.php file and adding this code just before the line that says ‘That’s all, stop editing! Happy blogging’.

快速解决方案是将以下代码添加到wp-config.php文件中。 您可以通过编辑wp-config.php文件并将此代码添加到“就这样,停止编辑! 祝您博客愉快”。


define('CONCATENATE_SCRIPTS', false );

This code simply tells WordPress to load each script separately which helps avoiding a JavaScript conflict with buggy scripts and the core WordPress features.

此代码仅告诉WordPress分别加载每个脚本,这有助于避免JavaScript与bug脚本和WordPress核心功能冲突。

After you have added the code, go ahead and the visit post edit screen to see if the add media button is working as expected.

添加代码后,继续操作,然后访问访问帖子编辑屏幕,以查看添加媒体按钮是否按预期工作。

Note: Adding this code is not a proper long-term solution because you still have a script that is causing the issue. An easier way to find the source of the problem is by using the inspect tool. It will show you console errors which can lead you to the source of the conflict.

注意:添加此代码不是正确的长期解决方案,因为您仍有导致此问题的脚本。 查找问题根源的简便方法是使用检查工具 。 它将向您显示控制台错误,这可能会导致您找到冲突的根源。

If you want a long-term fix for this issue, then you need to perform the basic WordPress troubleshooting tips to figure out which plugin or theme may be causing the issue.

如果您想长期解决此问题,则需要执行基本的WordPress故障排除提示,以找出可能是引起此问题的插件或主题。

We strongly recommend that you do this on your staging site instead of a live site. Here’s a step by step guide on how to create a WordPress staging site. All the best WordPress hosting companies like Bluehost, SiteGround, WP Engine, and Liquid Web offer 1-click staging functionality.

强烈建议您在暂存站点而不是实时站点上执行此操作。 这是有关如何创建WordPress登台站点的分步指南。 所有最好的WordPress托管公司(例如BluehostSiteGroundWP EngineLiquid Web)都提供一键式登台功能。

On your staging site, you need to start by deactivating all your WordPress plugins and then check if it fixed the ‘Add Media’ button. If it does, then this means one of the plugins was causing the issue.

在登台站点上,您需要首先停用所有WordPress插件,然后检查它是否修复了“添加媒体”按钮。 如果是这样,则表示其中一个插件引起了问题。

Deactivate all plugins

You can now activate the plugins one-by-one, and after activating a plugin check the ‘Add Media’ button. This will help you find out which plugin is causing the issue. After you find the culprit, you can replace it with another plugin or ask plugin author for help.

现在,您可以一次激活插件,并在激活插件后检查“添加媒体”按钮。 这将帮助您找出导致该问题的插件。 找到罪魁祸首后,您可以将其替换为另一个插件,或者向插件作者寻求帮助

If deactivating plugins doesn’t solve the issue, then the next step is to temporarily switch to a default WordPress theme like Twenty Seventeen.

如果停用插件不能解决问题,则下一步是暂时切换到默认的WordPress主题,例如“二十十七岁”。

Switch to a default WordPress theme

If switching to the default theme fixes the issue for you, then this means your theme is causing the conflict. You can ask theme author for support or switch to a different WordPress theme.

如果切换到默认主题可以为您解决问题,则意味着您的主题正在引起冲突。 您可以要求主题作者提供支持或切换到其他WordPress主题。

Once you find the source of the problem on your staging site, then you can apply the fix on your live WordPress site.

在临时站点上找到问题的根源后,即可在实时WordPress站点上应用此修复程序。

We hope this article helped you learn how to fix add media button not working in WordPress. You may also want to see our list of the most common WordPress errors and how to fix them.

我们希望本文能帮助您学习如何修复无法在WordPress中使用的添加媒体按钮。 您可能还希望查看我们最常见的WordPress错误列表以及如何修复它们。

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-fix-add-media-button-not-working-in-wordpress/

wordpress添加媒体

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值