On one of our clients websites, when you try to view the "plugins" page in the back-end, the page loads for several minutes, then returns a 404 (using the WordPress 404 template). This is a project that we inherited, and it's quite a mess; there are around 50 plugins installed, so I'm sure that's eating up a lot of resources.

The file /wp-admin/plugins.php definitely exists, so we're very confused how this is returning a 404. It almost seems like it's running out of memory, but if that were the case, wouldn't it error with a 500 instead of 404?

What could be causing this, or what is the recommended method for trying to track this down?


I've installed Query Monitor and Rewrite Rules Inspector, here are my findings:

Query Monitor

The plugins page is using up a lot of memory at 40 MB (compared to ~7.3 on one of our more standard sites), but it's nowhere near its limit of 256 MB. Nothing in the data looks egregiously slow, but this issue is intermittent, so I have to wait for it to happen again to be able to test the actual issue.

Rewrite Rules Inspector

I see that there are two rules that match for /wp-admin/plugins.php; one for "page" and one for "post." The more standard site that I tested on only includes the "page" rule. I've included the table below.

Rule Rewrite Source
(.?.+?)(?:/([0-9]+))?/?$ index.php?pagename=$matches[1]&page=$matches[2] page
[^/]+/([^/]+)/?$ index.php?attachment=$matches[1] post

I guess to test this, I could just disable the .htaccess rules, so next time this issue crops up (likely tomorrow), I'll give that a try and report back.

Other Thoughts

This site uses a caching plugin that I'm not familiar with; W3 Total Cache. As this is another plugin that "rewrites" page contents, could it be that the caching plugin is trying to serve a cached version of /wp-admin/plugins.php?


I believe I've tracked down the root of the problem: a plugin called GeoDirectory. It's including the rewrite rules which I previously mentioned. I tried to write a rewrite rule with a higher priority as a workaround, but that didn't seem to work.

 * Fix PHP files sometimes loading like WordPress pages
function wpd_rewrite_rules(): void {
    add_rewrite_rule("(.*\.php$)", '$matches[1]', "top");
add_action("init", "wpd_rewrite_rules", PHP_INT_MAX);

This redirect to something like pagename=wp-admin%2Fplugins.php, which obviously isn't correct. Is there a way to write a workaround, or should I just try to get in contact with the developer of GeoDirectory to fix this?

  • the only scenario I can think of is that you have 2 servers handling the same site but only one of them has a full wp-admin folder or even serves WP. Note that it's not the number of plugins that makes a site slow, but rather it's doing a lot of things that makes a site slow. Naturally more plugins do more things but a single plugin or even no plugins and a heavy theme can add all that weight, just as well as a site can be fast with 100 plugins if those plugins are all tiny and lightweight
    – Tom J Nowell
    Mar 16, 2023 at 19:18
  • It's also useful to know what kind of 404, is it an Nginx/Apache 404 or a WordPress 404 or a CDN 404 etc etc And if it's slow to load what exactly is slow? Lots of DB queries? Making an expensive HTTP request? Be specific! And remember, this isn't a messageboard/discussion forum, you need a specific question that has all the info needed to answer it, phrased in such a way that you can mark an answer as correct for all people who have that question. So don't ask open ended questions
    – Tom J Nowell
    Mar 16, 2023 at 19:19
  • It's on a single server, no fancy load balancing or anything like that. It loads a 404 just like any other 404 on the site, so I'm not sure if that's consider a "WordPress 404" or an "Apache 404" (we do use Apache). I'll see if I can get Query Monitor installed to try and track down some stats, but being unable to access the Plugins page, that's some what difficult (can't use wp-cli unfortunately) Mar 16, 2023 at 19:21
  • As far as not asking open ended questions, where would you suggest I go for that instead? I came here because we're stumped. Mar 16, 2023 at 19:22
  • 1
    If you've singled out a plugin as the cause of your issue, then yes, contact that plugin's support team. If it's happening to you, it's happening to others.
    – Pat J
    Mar 17, 2023 at 16:26


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.