If you’ve encountered issues with admin-ajax.php in a WordPress multi-site setup, you’re not alone. The discussion below highlights a problem faced by a user and a subsequent workaround. Let’s explore the problem and the solution in simple terms.

Understanding the Problem

The user reports an error with admin-ajax.php, a file crucial for asynchronous communication in WordPress. The issue arises when accessing admin-ajax.php directly, especially in a subdirectory multi-site setup on a subdomain. The error is puzzling because, in theory, it should return ‘0’ when no action is set, but an additional error message is being displayed.

Investigating the Symptoms

The user experiences this problem when uploading files through the Media Library on a newly created sub-site. Despite successful file uploads to the server, a generic “HTTP error” occurs in the Media Library, and files aren’t added to the WordPress database. The error also manifests in other areas of the WP Admin, indicating a broader issue.

Attempted Solutions

The user diligently tries common troubleshooting steps. Disabling plugins and switching to a default theme have no impact on the problem. Additionally, the user verifies that error logging is enabled, yet the logs show no information about the encountered error.

The Workaround

In the discussion, the user discovers a workaround that resolves the issue, although not in the way initially expected. The solution involves switching from a subdirectory multi-site setup to a subdomain multi-site setup. By changing the URLs to mu.site.com/ and sub-site.site.com/, and updating the .htaccess file accordingly, the problem disappears, and everything starts working as expected.

Implementing the Workaround

  1. Update URLs: Change the multi-site URLs from subdirectories to subdomains. This involves updating the main site URL and the sub-site URL.Example:
    • Before: mu.site.com/sub-site/
    • After: mu.site.com/ and sub-site.site.com/
  2. Modify .htaccess: Adjust the .htaccess file to reflect the changes made to the URLs. Ensure that the .htaccess file is configured for a subdomain multi-site setup.


    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    # Main site
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    # Sub-sites
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) sub-site.site.com/$2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ sub-site.site.com/$2 [L]
    RewriteRule . sub-site.site.com/index.php [L]
    1. Test: After making these changes, test the Media Library file upload and other admin-ajax.php functionalities to ensure the issue is resolved.


    While the exact reason behind the problem remains unclear, the workaround provided by the user offers a viable solution. By transitioning to a subdomain multi-site setup, the issues with admin-ajax.php are mitigated, allowing for seamless operation within WordPress. If you’re facing similar challenges, give this workaround a try and adapt it to your specific configuration.

Leave a Reply

Your email address will not be published. Required fields are marked *