Troubleshooting

Website Forms Are Not Submitting Correctly After Changing Ajax Path

If contact forms, comment forms, or other AJAX-powered forms stop submitting after changing the admin-ajax.php path in WP Ghost, the form plugin is still sending requests to the old AJAX URL. Most form plugins (Contact Form 7, WPForms, Gravity Forms, Ninja Forms, etc.) use WordPress’s admin_url('admin-ajax.php') to locate the AJAX endpoint, which WP Ghost rewrites automatically. If forms still break, the issue is usually caching or server configuration.

Clear all caches

Cached pages contain the old admin-ajax.php URL in their JavaScript. Clear your WordPress cache plugin, CDN cache, and browser cache. Enable Change Paths in Cached Files at WP Ghost > Change Paths so cached JS files are rewritten with the new AJAX path. Test the form in an incognito window after clearing.

Run the Frontend Test

Go to WP Ghost > Change Paths and click the Frontend Test button. If the test fails for the AJAX path, your server’s rewrite rules aren’t mapping it correctly. Follow the configuration instructions shown for your server type.

Flush permalink settings

Go to Settings > Permalinks and click Save Changes without modifying anything. This regenerates rewrite rules that map the custom AJAX path to the original endpoint.

Check for hardcoded AJAX URLs

Some form plugins or custom theme code hardcode the AJAX URL instead of using admin_url(). Open your browser’s developer console (F12 > Network tab), submit the form, and check which URL the form sends its request to. If it shows the old /wp-admin/admin-ajax.php instead of your custom path, the form plugin is hardcoding the URL. Contact the plugin’s support or add the old AJAX path to WP Ghost > Change Paths > Whitelist Paths.

Revert to the default admin-ajax path

To confirm the custom path is causing the issue, go to WP Ghost > Change Paths > Ajax Security and set the path back to admin-ajax.php. Save and test the form. If forms work with the default path, the issue is server rewrite rules or a plugin hardcoding the old URL.

If you’ve lost access to the admin dashboard, see the emergency disable guide.

John Darrel

Change the WordPress Database Prefix for Security

Replace the default wp_ database prefix with a random one to protect against SQL injection…

1 year

Customize WordPress Uploads Directory | WP Ghost

Change the WordPress uploads directory path with WP Ghost (rewrite rules, no files moved) or…

1 year

WP Ghost and WP Rocket Cache Setup Guide

Configure WP Ghost with WP Rocket cache. Enable file optimization, Change Paths in Cache Files.…

1 year

Why is website security important?

https://youtu.be/6ylhojSi-_E In this video, we’ll explore why website security matters and what can happen if…

1 year

Is WordPress Website Easily Hacked?

The security of your WordPress site depends on multiple factors, such as the strength of…

1 year

Set Up WordPress 2FA with Mobile Authenticator Apps

Step-by-step guides to connect WP Ghost 2FA with Google Authenticator, Authy, Microsoft Authenticator, or LastPass.…

1 year