跳到正文
WordPress

Elementor “Can’t Edit?” Error on Nginx: Fix the try_files Rule

Change try_files $uri $uri/ /index.php; to try_files $uri $uri/ /index.php?$args; in the site’s location / block, test with nginx -t and reload.

测试环境 Nginx 1.18–1.24, WordPress 6.x

Elementor warning: Can’t Edit? Having trouble loading Elementor?

You open a page in Elementor and, instead of the editor, see “Can’t Edit? Having trouble loading Elementor? Please enable Safe Mode to Troubleshoot.” On Nginx servers the cause is often a try_files rule that throws away the query string WordPress needs.

Why it happens

Elementor (and much of WordPress) loads the editor through URLs such as /wp-admin/post.php?post=12&action=elementor and REST requests with parameters. If Nginx rewrites requests to /index.php without ?$args, those parameters never reach PHP.

The fix

  1. Open your site’s config, usually /etc/nginx/sites-available/your-site.conf.
  2. Find the location / block.
  3. Add ?$args to the end of try_files.
Site config
# Beforenlocation / {n    try_files $uri $uri/ /index.php;n}nn# Afternlocation / {n    try_files $uri $uri/ /index.php?$args;n}

Test and reload

Terminal
sudo nginx -tnsudo systemctl reload nginx

Reload the Elementor editor – it should open normally.

Still not loading?

Then check the usual suspects: PHP memory_limit below 256M, a security plugin blocking /wp-json/, or a caching/optimisation plugin that minifies admin scripts. The browser console (F12) shows which request fails.

Inder Kochar

作者

Inder Kochar

系统与网络工程师 – 我把为客户使用的解决方案整理成文,并在真实系统上测试过。遇到类似问题了吗?

继续阅读

提出问题或分享您的解决方法

您的邮箱不会公开。评论需经审核——请围绕主题发言。